We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Remove mock from test requirements?
I'm learning how to write mock tests, and I noticed things like `import mock` are workarounds to support PY27 and older PY3. Since CuPy now support PY35+ only and `mock` becomes part of the standard Python library, I suppose this line is no longer needed:
https://github.com/cupy/cupy/blob/74dcb4172578a0771e06f4e44b10b5f73f68fb59/setup.py#L39
and all `import mock` can be replaced by `from unittest import mock`?

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `setup.py`
Content:
```
1 #!/usr/bin/env python
2 
3 import os
4 from setuptools import setup, find_packages
5 import sys
6 
7 import cupy_setup_build
8 
9 
10 if sys.version_info[:3] == (3, 5, 0):
11     if not int(os.getenv('CUPY_PYTHON_350_FORCE', '0')):
12         msg = """
13 CuPy does not work with Python 3.5.0.
14 
15 We strongly recommend to use another version of Python.
16 If you want to use CuPy with Python 3.5.0 at your own risk,
17 set 1 to CUPY_PYTHON_350_FORCE environment variable."""
18         print(msg)
19         sys.exit(1)
20 
21 
22 requirements = {
23     'setup': [
24         'fastrlock>=0.3',
25     ],
26     'install': [
27         'numpy>=1.15',
28         'fastrlock>=0.3',
29     ],
30     'stylecheck': [
31         'autopep8==1.3.5',
32         'flake8==3.5.0',
33         'pbr==4.0.4',
34         'pycodestyle==2.3.1',
35     ],
36     'test': [
37         'pytest<4.2.0',  # 4.2.0 is slow collecting tests and times out on CI.
38         'attrs<19.2.0',  # pytest 4.1.1 does not run with attrs==19.2.0
39         'mock',
40     ],
41     'doctest': [
42         'matplotlib',
43         'optuna',
44     ],
45     'docs': [
46         'sphinx==3.0.4',
47         'sphinx_rtd_theme',
48     ],
49     'travis': [
50         '-r stylecheck',
51         '-r docs',
52     ],
53     'appveyor': [
54         '-r test',
55     ],
56     'jenkins': [
57         '-r test',
58         'pytest-timeout',
59         'pytest-cov',
60         'coveralls',
61         'codecov',
62     ],
63 }
64 
65 
66 def reduce_requirements(key):
67     # Resolve recursive requirements notation (-r)
68     reqs = requirements[key]
69     resolved_reqs = []
70     for req in reqs:
71         if req.startswith('-r'):
72             depend_key = req[2:].lstrip()
73             reduce_requirements(depend_key)
74             resolved_reqs += requirements[depend_key]
75         else:
76             resolved_reqs.append(req)
77     requirements[key] = resolved_reqs
78 
79 
80 for k in requirements.keys():
81     reduce_requirements(k)
82 
83 
84 extras_require = {k: v for k, v in requirements.items() if k != 'install'}
85 
86 
87 setup_requires = requirements['setup']
88 install_requires = requirements['install']
89 tests_require = requirements['test']
90 
91 
92 package_data = {
93     'cupy': [
94         'core/include/cupy/complex/arithmetic.h',
95         'core/include/cupy/complex/catrig.h',
96         'core/include/cupy/complex/catrigf.h',
97         'core/include/cupy/complex/ccosh.h',
98         'core/include/cupy/complex/ccoshf.h',
99         'core/include/cupy/complex/cexp.h',
100         'core/include/cupy/complex/cexpf.h',
101         'core/include/cupy/complex/clog.h',
102         'core/include/cupy/complex/clogf.h',
103         'core/include/cupy/complex/complex.h',
104         'core/include/cupy/complex/complex_inl.h',
105         'core/include/cupy/complex/cpow.h',
106         'core/include/cupy/complex/cproj.h',
107         'core/include/cupy/complex/csinh.h',
108         'core/include/cupy/complex/csinhf.h',
109         'core/include/cupy/complex/csqrt.h',
110         'core/include/cupy/complex/csqrtf.h',
111         'core/include/cupy/complex/ctanh.h',
112         'core/include/cupy/complex/ctanhf.h',
113         'core/include/cupy/complex/math_private.h',
114         'core/include/cupy/carray.cuh',
115         'core/include/cupy/complex.cuh',
116         'core/include/cupy/atomics.cuh',
117         'core/include/cupy/cuComplex_bridge.h',
118         'core/include/cupy/_cuda/cuda-*/*.h',
119         'core/include/cupy/_cuda/cuda-*/*.hpp',
120         'cuda/cupy_thrust.cu',
121     ],
122 }
123 
124 package_data['cupy'] += cupy_setup_build.prepare_wheel_libs()
125 
126 package_name = cupy_setup_build.get_package_name()
127 long_description = cupy_setup_build.get_long_description()
128 ext_modules = cupy_setup_build.get_ext_modules()
129 build_ext = cupy_setup_build.custom_build_ext
130 sdist = cupy_setup_build.sdist_with_cython
131 
132 here = os.path.abspath(os.path.dirname(__file__))
133 # Get __version__ variable
134 exec(open(os.path.join(here, 'cupy', '_version.py')).read())
135 
136 CLASSIFIERS = """\
137 Development Status :: 5 - Production/Stable
138 Intended Audience :: Science/Research
139 Intended Audience :: Developers
140 License :: OSI Approved :: MIT License
141 Programming Language :: Python
142 Programming Language :: Python :: 3
143 Programming Language :: Python :: 3.5
144 Programming Language :: Python :: 3.6
145 Programming Language :: Python :: 3.7
146 Programming Language :: Python :: 3 :: Only
147 Programming Language :: Cython
148 Topic :: Software Development
149 Topic :: Scientific/Engineering
150 Operating System :: Microsoft :: Windows
151 Operating System :: POSIX
152 Operating System :: MacOS
153 """
154 
155 
156 setup(
157     name=package_name,
158     version=__version__,  # NOQA
159     description='CuPy: NumPy-like API accelerated with CUDA',
160     long_description=long_description,
161     author='Seiya Tokui',
162     author_email='tokui@preferred.jp',
163     url='https://cupy.chainer.org/',
164     license='MIT License',
165     project_urls={
166         "Bug Tracker": "https://github.com/cupy/cupy/issues",
167         "Documentation": "https://docs-cupy.chainer.org/",
168         "Source Code": "https://github.com/cupy/cupy",
169     },
170     classifiers=[_f for _f in CLASSIFIERS.split('\n') if _f],
171     packages=find_packages(exclude=['install', 'tests']),
172     package_data=package_data,
173     zip_safe=False,
174     python_requires='>=3.5.0',
175     setup_requires=setup_requires,
176     install_requires=install_requires,
177     tests_require=tests_require,
178     extras_require=extras_require,
179     ext_modules=ext_modules,
180     cmdclass={'build_ext': build_ext,
181               'sdist': sdist},
182 )
183
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -36,7 +36,6 @@
     'test': [
         'pytest<4.2.0',  # 4.2.0 is slow collecting tests and times out on CI.
         'attrs<19.2.0',  # pytest 4.1.1 does not run with attrs==19.2.0
-        'mock',
     ],
     'doctest': [
         'matplotlib',

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -36,7 +36,6 @@\n     'test': [\n         'pytest<4.2.0',  # 4.2.0 is slow collecting tests and times out on CI.\n         'attrs<19.2.0',  # pytest 4.1.1 does not run with attrs==19.2.0\n-        'mock',\n     ],\n     'doctest': [\n         'matplotlib',\n", "issue": "Remove mock from test requirements?\nI'm learning how to write mock tests, and I noticed things like `import mock` are workarounds to support PY27 and older PY3. Since CuPy now support PY35+ only and `mock` becomes part of the standard Python library, I suppose this line is no longer needed:\r\nhttps://github.com/cupy/cupy/blob/74dcb4172578a0771e06f4e44b10b5f73f68fb59/setup.py#L39\r\nand all `import mock` can be replaced by `from unittest import mock`?\n", "before_files": [{"content": "#!/usr/bin/env python\n\nimport os\nfrom setuptools import setup, find_packages\nimport sys\n\nimport cupy_setup_build\n\n\nif sys.version_info[:3] == (3, 5, 0):\n    if not int(os.getenv('CUPY_PYTHON_350_FORCE', '0')):\n        msg = \"\"\"\nCuPy does not work with Python 3.5.0.\n\nWe strongly recommend to use another version of Python.\nIf you want to use CuPy with Python 3.5.0 at your own risk,\nset 1 to CUPY_PYTHON_350_FORCE environment variable.\"\"\"\n        print(msg)\n        sys.exit(1)\n\n\nrequirements = {\n    'setup': [\n        'fastrlock>=0.3',\n    ],\n    'install': [\n        'numpy>=1.15',\n        'fastrlock>=0.3',\n    ],\n    'stylecheck': [\n        'autopep8==1.3.5',\n        'flake8==3.5.0',\n        'pbr==4.0.4',\n        'pycodestyle==2.3.1',\n    ],\n    'test': [\n        'pytest<4.2.0',  # 4.2.0 is slow collecting tests and times out on CI.\n        'attrs<19.2.0',  # pytest 4.1.1 does not run with attrs==19.2.0\n        'mock',\n    ],\n    'doctest': [\n        'matplotlib',\n        'optuna',\n    ],\n    'docs': [\n        'sphinx==3.0.4',\n        'sphinx_rtd_theme',\n    ],\n    'travis': [\n        '-r stylecheck',\n        '-r docs',\n    ],\n    'appveyor': [\n        '-r test',\n    ],\n    'jenkins': [\n        '-r test',\n        'pytest-timeout',\n        'pytest-cov',\n        'coveralls',\n        'codecov',\n    ],\n}\n\n\ndef reduce_requirements(key):\n    # Resolve recursive requirements notation (-r)\n    reqs = requirements[key]\n    resolved_reqs = []\n    for req in reqs:\n        if req.startswith('-r'):\n            depend_key = req[2:].lstrip()\n            reduce_requirements(depend_key)\n            resolved_reqs += requirements[depend_key]\n        else:\n            resolved_reqs.append(req)\n    requirements[key] = resolved_reqs\n\n\nfor k in requirements.keys():\n    reduce_requirements(k)\n\n\nextras_require = {k: v for k, v in requirements.items() if k != 'install'}\n\n\nsetup_requires = requirements['setup']\ninstall_requires = requirements['install']\ntests_require = requirements['test']\n\n\npackage_data = {\n    'cupy': [\n        'core/include/cupy/complex/arithmetic.h',\n        'core/include/cupy/complex/catrig.h',\n        'core/include/cupy/complex/catrigf.h',\n        'core/include/cupy/complex/ccosh.h',\n        'core/include/cupy/complex/ccoshf.h',\n        'core/include/cupy/complex/cexp.h',\n        'core/include/cupy/complex/cexpf.h',\n        'core/include/cupy/complex/clog.h',\n        'core/include/cupy/complex/clogf.h',\n        'core/include/cupy/complex/complex.h',\n        'core/include/cupy/complex/complex_inl.h',\n        'core/include/cupy/complex/cpow.h',\n        'core/include/cupy/complex/cproj.h',\n        'core/include/cupy/complex/csinh.h',\n        'core/include/cupy/complex/csinhf.h',\n        'core/include/cupy/complex/csqrt.h',\n        'core/include/cupy/complex/csqrtf.h',\n        'core/include/cupy/complex/ctanh.h',\n        'core/include/cupy/complex/ctanhf.h',\n        'core/include/cupy/complex/math_private.h',\n        'core/include/cupy/carray.cuh',\n        'core/include/cupy/complex.cuh',\n        'core/include/cupy/atomics.cuh',\n        'core/include/cupy/cuComplex_bridge.h',\n        'core/include/cupy/_cuda/cuda-*/*.h',\n        'core/include/cupy/_cuda/cuda-*/*.hpp',\n        'cuda/cupy_thrust.cu',\n    ],\n}\n\npackage_data['cupy'] += cupy_setup_build.prepare_wheel_libs()\n\npackage_name = cupy_setup_build.get_package_name()\nlong_description = cupy_setup_build.get_long_description()\next_modules = cupy_setup_build.get_ext_modules()\nbuild_ext = cupy_setup_build.custom_build_ext\nsdist = cupy_setup_build.sdist_with_cython\n\nhere = os.path.abspath(os.path.dirname(__file__))\n# Get __version__ variable\nexec(open(os.path.join(here, 'cupy', '_version.py')).read())\n\nCLASSIFIERS = \"\"\"\\\nDevelopment Status :: 5 - Production/Stable\nIntended Audience :: Science/Research\nIntended Audience :: Developers\nLicense :: OSI Approved :: MIT License\nProgramming Language :: Python\nProgramming Language :: Python :: 3\nProgramming Language :: Python :: 3.5\nProgramming Language :: Python :: 3.6\nProgramming Language :: Python :: 3.7\nProgramming Language :: Python :: 3 :: Only\nProgramming Language :: Cython\nTopic :: Software Development\nTopic :: Scientific/Engineering\nOperating System :: Microsoft :: Windows\nOperating System :: POSIX\nOperating System :: MacOS\n\"\"\"\n\n\nsetup(\n    name=package_name,\n    version=__version__,  # NOQA\n    description='CuPy: NumPy-like API accelerated with CUDA',\n    long_description=long_description,\n    author='Seiya Tokui',\n    author_email='tokui@preferred.jp',\n    url='https://cupy.chainer.org/',\n    license='MIT License',\n    project_urls={\n        \"Bug Tracker\": \"https://github.com/cupy/cupy/issues\",\n        \"Documentation\": \"https://docs-cupy.chainer.org/\",\n        \"Source Code\": \"https://github.com/cupy/cupy\",\n    },\n    classifiers=[_f for _f in CLASSIFIERS.split('\\n') if _f],\n    packages=find_packages(exclude=['install', 'tests']),\n    package_data=package_data,\n    zip_safe=False,\n    python_requires='>=3.5.0',\n    setup_requires=setup_requires,\n    install_requires=install_requires,\n    tests_require=tests_require,\n    extras_require=extras_require,\n    ext_modules=ext_modules,\n    cmdclass={'build_ext': build_ext,\n              'sdist': sdist},\n)\n", "path": "setup.py"}], "after_files": [{"content": "#!/usr/bin/env python\n\nimport os\nfrom setuptools import setup, find_packages\nimport sys\n\nimport cupy_setup_build\n\n\nif sys.version_info[:3] == (3, 5, 0):\n    if not int(os.getenv('CUPY_PYTHON_350_FORCE', '0')):\n        msg = \"\"\"\nCuPy does not work with Python 3.5.0.\n\nWe strongly recommend to use another version of Python.\nIf you want to use CuPy with Python 3.5.0 at your own risk,\nset 1 to CUPY_PYTHON_350_FORCE environment variable.\"\"\"\n        print(msg)\n        sys.exit(1)\n\n\nrequirements = {\n    'setup': [\n        'fastrlock>=0.3',\n    ],\n    'install': [\n        'numpy>=1.15',\n        'fastrlock>=0.3',\n    ],\n    'stylecheck': [\n        'autopep8==1.3.5',\n        'flake8==3.5.0',\n        'pbr==4.0.4',\n        'pycodestyle==2.3.1',\n    ],\n    'test': [\n        'pytest<4.2.0',  # 4.2.0 is slow collecting tests and times out on CI.\n        'attrs<19.2.0',  # pytest 4.1.1 does not run with attrs==19.2.0\n    ],\n    'doctest': [\n        'matplotlib',\n        'optuna',\n    ],\n    'docs': [\n        'sphinx==3.0.4',\n        'sphinx_rtd_theme',\n    ],\n    'travis': [\n        '-r stylecheck',\n        '-r docs',\n    ],\n    'appveyor': [\n        '-r test',\n    ],\n    'jenkins': [\n        '-r test',\n        'pytest-timeout',\n        'pytest-cov',\n        'coveralls',\n        'codecov',\n    ],\n}\n\n\ndef reduce_requirements(key):\n    # Resolve recursive requirements notation (-r)\n    reqs = requirements[key]\n    resolved_reqs = []\n    for req in reqs:\n        if req.startswith('-r'):\n            depend_key = req[2:].lstrip()\n            reduce_requirements(depend_key)\n            resolved_reqs += requirements[depend_key]\n        else:\n            resolved_reqs.append(req)\n    requirements[key] = resolved_reqs\n\n\nfor k in requirements.keys():\n    reduce_requirements(k)\n\n\nextras_require = {k: v for k, v in requirements.items() if k != 'install'}\n\n\nsetup_requires = requirements['setup']\ninstall_requires = requirements['install']\ntests_require = requirements['test']\n\n\npackage_data = {\n    'cupy': [\n        'core/include/cupy/complex/arithmetic.h',\n        'core/include/cupy/complex/catrig.h',\n        'core/include/cupy/complex/catrigf.h',\n        'core/include/cupy/complex/ccosh.h',\n        'core/include/cupy/complex/ccoshf.h',\n        'core/include/cupy/complex/cexp.h',\n        'core/include/cupy/complex/cexpf.h',\n        'core/include/cupy/complex/clog.h',\n        'core/include/cupy/complex/clogf.h',\n        'core/include/cupy/complex/complex.h',\n        'core/include/cupy/complex/complex_inl.h',\n        'core/include/cupy/complex/cpow.h',\n        'core/include/cupy/complex/cproj.h',\n        'core/include/cupy/complex/csinh.h',\n        'core/include/cupy/complex/csinhf.h',\n        'core/include/cupy/complex/csqrt.h',\n        'core/include/cupy/complex/csqrtf.h',\n        'core/include/cupy/complex/ctanh.h',\n        'core/include/cupy/complex/ctanhf.h',\n        'core/include/cupy/complex/math_private.h',\n        'core/include/cupy/carray.cuh',\n        'core/include/cupy/complex.cuh',\n        'core/include/cupy/atomics.cuh',\n        'core/include/cupy/cuComplex_bridge.h',\n        'core/include/cupy/_cuda/cuda-*/*.h',\n        'core/include/cupy/_cuda/cuda-*/*.hpp',\n        'cuda/cupy_thrust.cu',\n    ],\n}\n\npackage_data['cupy'] += cupy_setup_build.prepare_wheel_libs()\n\npackage_name = cupy_setup_build.get_package_name()\nlong_description = cupy_setup_build.get_long_description()\next_modules = cupy_setup_build.get_ext_modules()\nbuild_ext = cupy_setup_build.custom_build_ext\nsdist = cupy_setup_build.sdist_with_cython\n\nhere = os.path.abspath(os.path.dirname(__file__))\n# Get __version__ variable\nexec(open(os.path.join(here, 'cupy', '_version.py')).read())\n\nCLASSIFIERS = \"\"\"\\\nDevelopment Status :: 5 - Production/Stable\nIntended Audience :: Science/Research\nIntended Audience :: Developers\nLicense :: OSI Approved :: MIT License\nProgramming Language :: Python\nProgramming Language :: Python :: 3\nProgramming Language :: Python :: 3.5\nProgramming Language :: Python :: 3.6\nProgramming Language :: Python :: 3.7\nProgramming Language :: Python :: 3 :: Only\nProgramming Language :: Cython\nTopic :: Software Development\nTopic :: Scientific/Engineering\nOperating System :: Microsoft :: Windows\nOperating System :: POSIX\nOperating System :: MacOS\n\"\"\"\n\n\nsetup(\n    name=package_name,\n    version=__version__,  # NOQA\n    description='CuPy: NumPy-like API accelerated with CUDA',\n    long_description=long_description,\n    author='Seiya Tokui',\n    author_email='tokui@preferred.jp',\n    url='https://cupy.chainer.org/',\n    license='MIT License',\n    project_urls={\n        \"Bug Tracker\": \"https://github.com/cupy/cupy/issues\",\n        \"Documentation\": \"https://docs-cupy.chainer.org/\",\n        \"Source Code\": \"https://github.com/cupy/cupy\",\n    },\n    classifiers=[_f for _f in CLASSIFIERS.split('\\n') if _f],\n    packages=find_packages(exclude=['install', 'tests']),\n    package_data=package_data,\n    zip_safe=False,\n    python_requires='>=3.5.0',\n    setup_requires=setup_requires,\n    install_requires=install_requires,\n    tests_require=tests_require,\n    extras_require=extras_require,\n    ext_modules=ext_modules,\n    cmdclass={'build_ext': build_ext,\n              'sdist': sdist},\n)\n", "path": "setup.py"}]}