testing-cabal / mock

The Python mock library

Home Page:https://docs.python.org/dev/library/unittest.mock.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CI to ensure package is installable and importable.

banthar opened this issue · comments

Running this on fresh Python installation:

pip install -U mock && python -c "import mock"

fails with:

Collecting mock
  Downloading https://files.pythonhosted.org/packages/59/83/8fcdcf4babcc55290e50cbd54fcc9fcdd81c2e62eff27c1e6a2f23d79381/mock-3.0.0-py2.py3-none-any.whl
Installing collected packages: mock
Successfully installed mock-3.0.0
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/mock/__init__.py", line 2, in <module>
	import mock.mock as _mock
  File "/usr/local/lib/python3.7/site-packages/mock/mock.py", line 68, in <module>
	import six
ModuleNotFoundError: No module named 'six'

Using previous mock version:

pip install "mock<3.0.0" && python -c "import mock"

works without issue:

Collecting mock<3.0.0
  Downloading https://files.pythonhosted.org/packages/e6/35/f187bdf23be87092bd0f1200d43d23076cee4d0dec109f195173fd3ebc79/mock-2.0.0-py2.py3-none-any.whl (56kB)
Collecting pbr>=0.11 (from mock<3.0.0)
  Downloading https://files.pythonhosted.org/packages/07/3e/22d1d35a4b51706ca3590c54359aeb5fa7ea60df46180143a3ea13d45f29/pbr-5.2.0-py2.py3-none-any.whl (107kB)
Collecting six>=1.9 (from mock<3.0.0)
  Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Installing collected packages: pbr, six, mock
Successfully installed mock-2.0.0 pbr-5.2.0 six-1.12.0

The same is visible both on Python2.7 and Python3.7. Looks like dependencies on six and funcsigs are missing in 3.0.0 when installing via pip.

Fix in 7f848cb, 3.0.1 should be out shortly.

Note that both six and funcsigs dependencies are missing.
To make it work I need to do:

pip install mock six funcsigs

On 2.7 I'm still getting:

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting mock
  Downloading https://files.pythonhosted.org/packages/c4/2d/086714bc7d16f96a3aa07148c6c7d29c8f62965d9b72b4010bac337961cf/mock-3.0.1-py2.py3-none-any.whl
Collecting six (from mock)
  Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Installing collected packages: six, mock
Successfully installed mock-3.0.1 six-1.12.0
You are using pip version 19.0.3, however version 19.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/mock/__init__.py", line 2, in <module>
	import mock.mock as _mock
  File "/usr/local/lib/python2.7/site-packages/mock/mock.py", line 79, in <module>
	import funcsigs
ImportError: No module named funcsigs

Gah, sorry.

Fix in 9c75ce9, 3.0.2 should be out shortly.

Though dependencies are fixed perhaps a CI check to do below would help in future?

$ python setup.py install
$ python -c 'import mock'

As of 3.0.2 working fine both on Python2.7 and Python3.7. Thanks!

We should also check for license and changelog, see #459 .