You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Running pytest against non develop install fails #6973
First problem is that matplotlib.testing.nose isn't installed. That is easy to fix by adding it to setupext.py
But I am not sure what to do about the next problem:
=========================================================================================== test session starts ============================================================================================
platform darwin -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
rootdir: /Users/jhn/src/python/matplotlib, inifile: pytest.ini
plugins: cov-2.3.1, faulthandler-1.3.0, timeout-1.0.0, xdist-1.15.0
collected 0 items / 67 errors
...
____________________________________________________________________ ERROR collecting lib/matplotlib/sphinxext/tests/test_tinypages.py _____________________________________________________________________
import file mismatch:
imported module 'matplotlib.sphinxext.tests.test_tinypages' has this __file__ attribute:
/Users/jhn/Envs/mplmaster/lib/python3.5/site-packages/matplotlib/sphinxext/tests/test_tinypages.py
which is not the same as the test file we want to collect:
/Users/jhn/src/python/matplotlib/lib/matplotlib/sphinxext/tests/test_tinypages.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
I think that the second problem can only be fixed by replacing all absolute imports with relative ones or vice versa.
Relative imports will allow to run tests without installing matplotlib.
That seems a bit drastic. The "good practices" seem to indicate that tests should not include __init__.py. Or for inline and importable tests, running the tests directly on the installed package with py.test -ra --pyargs matplotlib should work.
Activity
Kojoley commentedon Aug 24, 2016
I think that the second problem can only be fixed by replacing all absolute imports with relative ones or vice versa.
Relative imports will allow to run tests without installing matplotlib.
QuLogic commentedon Aug 25, 2016
That seems a bit drastic. The "good practices" seem to indicate that tests should not include
__init__.py. Or for inline and importable tests, running the tests directly on the installed package withpy.test -ra --pyargs matplotlibshould work.phobson commentedon Mar 16, 2017
Has this issue gone stale?
QuLogic commentedon Mar 16, 2017
I don't really think it's a bug, TBH; pytest just does things slightly different.
anntzer commentedon Mar 23, 2017
FWIW #8135 solves this problem by making the installation step unnecessary.
QuLogic commentedon Feb 10, 2018
I'm closing this as I don't think it's a bug, and we have other issues for whether we want to add
setup.py test.