prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Install bug: Mock required for gradient_check
  #2972 Install bug
  
  Chainer installed with `pip install chainer`
  `from chainer import gradient_check` fails due to unable to find mock to import
  Fixed by `conda install mock`
  
  `gradient_check` is included in the block declarations in the tutorial, so it should either be removed from there or mock should be added to default install so that people doing the tutorial do not get an error during the import commands.
  
  ```
  from chainer import gradient_check
  
  ---------------------------------------------------------------------------
  ImportError                               Traceback (most recent call last)
  <ipython-input-1-0ba4708b632d> in <module>()
        1 import numpy as np
        2 import chainer
  ----> 3 from chainer import gradient_check
        4 from chainer import datasets, iterators, optimizers, serializers
        5 from chainer import Link, Chain, ChainList
  
  /home/crissman/.pyenv/versions/anaconda3-4.2.0/lib/python3.5/site-packages/chainer/gradient_check.py in <module>()
        7 from chainer import cuda
        8 from chainer.functions.math import identity
  ----> 9 from chainer import testing
       10 from chainer import variable
       11 
  
  /home/crissman/.pyenv/versions/anaconda3-4.2.0/lib/python3.5/site-packages/chainer/testing/__init__.py in <module>()
        5 from chainer.testing import parameterized  # NOQA
        6 from chainer.testing import serializer  # NOQA
  ----> 7 from chainer.testing import training  # NOQA
        8 from chainer.testing import unary_math_function_test  # NOQA
        9 
  
  /home/crissman/.pyenv/versions/anaconda3-4.2.0/lib/python3.5/site-packages/chainer/testing/training.py in <module>()
        1 from __future__ import division
        2 
  ----> 3 import mock
        4 
        5 from chainer import training
  
  ImportError: No module named '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 import pkg_resources
  5 import sys
  6 
  7 from setuptools import setup
  8 
  9 
  10 if sys.version_info[:3] == (3, 5, 0):
  11     if not int(os.getenv('CHAINER_PYTHON_350_FORCE', '0')):
  12         msg = """
  13 Chainer 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 Chainer with Python 3.5.0 at your own risk,
  17 set CHAINER_PYTHON_350_FORCE environment variable to 1."""
  18         print(msg)
  19         sys.exit(1)
  20 
  21 
  22 setup_requires = []
  23 install_requires = [
  24     'filelock',
  25     'nose',
  26     'numpy>=1.9.0',
  27     'protobuf>=2.6.0',
  28     'six>=1.9.0',
  29 ]
  30 cupy_require = 'cupy==2.0.0a1'
  31 
  32 cupy_pkg = None
  33 try:
  34     cupy_pkg = pkg_resources.get_distribution('cupy')
  35 except pkg_resources.DistributionNotFound:
  36     pass
  37 
  38 if cupy_pkg is not None:
  39     install_requires.append(cupy_require)
  40     print('Use %s' % cupy_require)
  41 
  42 setup(
  43     name='chainer',
  44     version='3.0.0a1',
  45     description='A flexible framework of neural networks',
  46     author='Seiya Tokui',
  47     author_email='tokui@preferred.jp',
  48     url='https://chainer.org/',
  49     license='MIT License',
  50     packages=['chainer',
  51               'chainer.dataset',
  52               'chainer.datasets',
  53               'chainer.functions',
  54               'chainer.functions.activation',
  55               'chainer.functions.array',
  56               'chainer.functions.connection',
  57               'chainer.functions.evaluation',
  58               'chainer.functions.loss',
  59               'chainer.functions.math',
  60               'chainer.functions.noise',
  61               'chainer.functions.normalization',
  62               'chainer.functions.pooling',
  63               'chainer.functions.theano',
  64               'chainer.functions.util',
  65               'chainer.function_hooks',
  66               'chainer.iterators',
  67               'chainer.initializers',
  68               'chainer.links',
  69               'chainer.links.activation',
  70               'chainer.links.caffe',
  71               'chainer.links.caffe.protobuf2',
  72               'chainer.links.caffe.protobuf3',
  73               'chainer.links.connection',
  74               'chainer.links.loss',
  75               'chainer.links.model',
  76               'chainer.links.model.vision',
  77               'chainer.links.normalization',
  78               'chainer.links.theano',
  79               'chainer.optimizers',
  80               'chainer.serializers',
  81               'chainer.testing',
  82               'chainer.training',
  83               'chainer.training.extensions',
  84               'chainer.training.triggers',
  85               'chainer.training.updaters',
  86               'chainer.utils'],
  87     zip_safe=False,
  88     setup_requires=setup_requires,
  89     install_requires=install_requires,
  90     tests_require=['mock',
  91                    'nose'],
  92 )
  93
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/setup.py b/setup.py
  --- a/setup.py
  +++ b/setup.py
  @@ -22,6 +22,7 @@
   setup_requires = []
   install_requires = [
       'filelock',
  +    'mock',
       'nose',
       'numpy>=1.9.0',
       'protobuf>=2.6.0',
  
verification_info: {"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -22,6 +22,7 @@\n setup_requires = []\n install_requires = [\n     'filelock',\n+    'mock',\n     'nose',\n     'numpy>=1.9.0',\n     'protobuf>=2.6.0',\n", "issue": "Install bug: Mock required for gradient_check\n#2972 Install bug\r\n\r\nChainer installed with `pip install chainer`\r\n`from chainer import gradient_check` fails due to unable to find mock to import\r\nFixed by `conda install mock`\r\n\r\n`gradient_check` is included in the block declarations in the tutorial, so it should either be removed from there or mock should be added to default install so that people doing the tutorial do not get an error during the import commands.\r\n\r\n```\r\nfrom chainer import gradient_check\r\n\r\n---------------------------------------------------------------------------\r\nImportError                               Traceback (most recent call last)\r\n<ipython-input-1-0ba4708b632d> in <module>()\r\n      1 import numpy as np\r\n      2 import chainer\r\n----> 3 from chainer import gradient_check\r\n      4 from chainer import datasets, iterators, optimizers, serializers\r\n      5 from chainer import Link, Chain, ChainList\r\n\r\n/home/crissman/.pyenv/versions/anaconda3-4.2.0/lib/python3.5/site-packages/chainer/gradient_check.py in <module>()\r\n      7 from chainer import cuda\r\n      8 from chainer.functions.math import identity\r\n----> 9 from chainer import testing\r\n     10 from chainer import variable\r\n     11 \r\n\r\n/home/crissman/.pyenv/versions/anaconda3-4.2.0/lib/python3.5/site-packages/chainer/testing/__init__.py in <module>()\r\n      5 from chainer.testing import parameterized  # NOQA\r\n      6 from chainer.testing import serializer  # NOQA\r\n----> 7 from chainer.testing import training  # NOQA\r\n      8 from chainer.testing import unary_math_function_test  # NOQA\r\n      9 \r\n\r\n/home/crissman/.pyenv/versions/anaconda3-4.2.0/lib/python3.5/site-packages/chainer/testing/training.py in <module>()\r\n      1 from __future__ import division\r\n      2 \r\n----> 3 import mock\r\n      4 \r\n      5 from chainer import training\r\n\r\nImportError: No module named 'mock'\r\n```\n", "before_files": [{"content": "#!/usr/bin/env python\n\nimport os\nimport pkg_resources\nimport sys\n\nfrom setuptools import setup\n\n\nif sys.version_info[:3] == (3, 5, 0):\n    if not int(os.getenv('CHAINER_PYTHON_350_FORCE', '0')):\n        msg = \"\"\"\nChainer does not work with Python 3.5.0.\n\nWe strongly recommend to use another version of Python.\nIf you want to use Chainer with Python 3.5.0 at your own risk,\nset CHAINER_PYTHON_350_FORCE environment variable to 1.\"\"\"\n        print(msg)\n        sys.exit(1)\n\n\nsetup_requires = []\ninstall_requires = [\n    'filelock',\n    'nose',\n    'numpy>=1.9.0',\n    'protobuf>=2.6.0',\n    'six>=1.9.0',\n]\ncupy_require = 'cupy==2.0.0a1'\n\ncupy_pkg = None\ntry:\n    cupy_pkg = pkg_resources.get_distribution('cupy')\nexcept pkg_resources.DistributionNotFound:\n    pass\n\nif cupy_pkg is not None:\n    install_requires.append(cupy_require)\n    print('Use %s' % cupy_require)\n\nsetup(\n    name='chainer',\n    version='3.0.0a1',\n    description='A flexible framework of neural networks',\n    author='Seiya Tokui',\n    author_email='tokui@preferred.jp',\n    url='https://chainer.org/',\n    license='MIT License',\n    packages=['chainer',\n              'chainer.dataset',\n              'chainer.datasets',\n              'chainer.functions',\n              'chainer.functions.activation',\n              'chainer.functions.array',\n              'chainer.functions.connection',\n              'chainer.functions.evaluation',\n              'chainer.functions.loss',\n              'chainer.functions.math',\n              'chainer.functions.noise',\n              'chainer.functions.normalization',\n              'chainer.functions.pooling',\n              'chainer.functions.theano',\n              'chainer.functions.util',\n              'chainer.function_hooks',\n              'chainer.iterators',\n              'chainer.initializers',\n              'chainer.links',\n              'chainer.links.activation',\n              'chainer.links.caffe',\n              'chainer.links.caffe.protobuf2',\n              'chainer.links.caffe.protobuf3',\n              'chainer.links.connection',\n              'chainer.links.loss',\n              'chainer.links.model',\n              'chainer.links.model.vision',\n              'chainer.links.normalization',\n              'chainer.links.theano',\n              'chainer.optimizers',\n              'chainer.serializers',\n              'chainer.testing',\n              'chainer.training',\n              'chainer.training.extensions',\n              'chainer.training.triggers',\n              'chainer.training.updaters',\n              'chainer.utils'],\n    zip_safe=False,\n    setup_requires=setup_requires,\n    install_requires=install_requires,\n    tests_require=['mock',\n                   'nose'],\n)\n", "path": "setup.py"}], "after_files": [{"content": "#!/usr/bin/env python\n\nimport os\nimport pkg_resources\nimport sys\n\nfrom setuptools import setup\n\n\nif sys.version_info[:3] == (3, 5, 0):\n    if not int(os.getenv('CHAINER_PYTHON_350_FORCE', '0')):\n        msg = \"\"\"\nChainer does not work with Python 3.5.0.\n\nWe strongly recommend to use another version of Python.\nIf you want to use Chainer with Python 3.5.0 at your own risk,\nset CHAINER_PYTHON_350_FORCE environment variable to 1.\"\"\"\n        print(msg)\n        sys.exit(1)\n\n\nsetup_requires = []\ninstall_requires = [\n    'filelock',\n    'mock',\n    'nose',\n    'numpy>=1.9.0',\n    'protobuf>=2.6.0',\n    'six>=1.9.0',\n]\ncupy_require = 'cupy==2.0.0a1'\n\ncupy_pkg = None\ntry:\n    cupy_pkg = pkg_resources.get_distribution('cupy')\nexcept pkg_resources.DistributionNotFound:\n    pass\n\nif cupy_pkg is not None:\n    install_requires.append(cupy_require)\n    print('Use %s' % cupy_require)\n\nsetup(\n    name='chainer',\n    version='3.0.0a1',\n    description='A flexible framework of neural networks',\n    author='Seiya Tokui',\n    author_email='tokui@preferred.jp',\n    url='https://chainer.org/',\n    license='MIT License',\n    packages=['chainer',\n              'chainer.dataset',\n              'chainer.datasets',\n              'chainer.functions',\n              'chainer.functions.activation',\n              'chainer.functions.array',\n              'chainer.functions.connection',\n              'chainer.functions.evaluation',\n              'chainer.functions.loss',\n              'chainer.functions.math',\n              'chainer.functions.noise',\n              'chainer.functions.normalization',\n              'chainer.functions.pooling',\n              'chainer.functions.theano',\n              'chainer.functions.util',\n              'chainer.function_hooks',\n              'chainer.iterators',\n              'chainer.initializers',\n              'chainer.links',\n              'chainer.links.activation',\n              'chainer.links.caffe',\n              'chainer.links.caffe.protobuf2',\n              'chainer.links.caffe.protobuf3',\n              'chainer.links.connection',\n              'chainer.links.loss',\n              'chainer.links.model',\n              'chainer.links.model.vision',\n              'chainer.links.normalization',\n              'chainer.links.theano',\n              'chainer.optimizers',\n              'chainer.serializers',\n              'chainer.testing',\n              'chainer.training',\n              'chainer.training.extensions',\n              'chainer.training.triggers',\n              'chainer.training.updaters',\n              'chainer.utils'],\n    zip_safe=False,\n    setup_requires=setup_requires,\n    install_requires=install_requires,\n    tests_require=['mock',\n                   'nose'],\n)\n", "path": "setup.py"}]}