Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running pytest locally fails #871

Closed
Alphare opened this issue Sep 3, 2019 · 7 comments
Closed

Running pytest locally fails #871

Alphare opened this issue Sep 3, 2019 · 7 comments
Labels
question Triaged as a question, not requiring action after answering

Comments

@Alphare
Copy link
Contributor

Alphare commented Sep 3, 2019

While working on updating my PR, I wanted to run the test suite locally after adding a test, and was greeted with the following message:

$ pytest -v
ImportError while loading conftest '[...]/asv/test/conftest.py'.
__init__.py:7: in <module>
    from asv.console import log
../asv/__init__.py:32: in <module>
    from . import plugin_manager
../asv/plugin_manager.py:60: in <module>
    plugin_manager.load_plugins(commands)
../asv/plugin_manager.py:30: in load_plugins
    __import__(name)
asv/commands/compare_variant.py:17: in <module>
    ???
E   ImportError: cannot import name results_default_iter

I have no idea when that issue started. Here is the output of pip freeze:

alabaster==0.7.12
asv==0.3.1
atomicwrites==1.3.0
attrs==19.1.0
Babel==2.6.0
certifi==2019.3.9
chardet==3.0.4
docutils==0.14
funcsigs==1.0.2
idna==2.8
imagesize==1.1.0
Jinja2==2.10
MarkupSafe==1.1.1
more-itertools==5.0.0
packaging==19.0
pathlib2==2.3.3
pluggy==0.9.0
py==1.8.0
Pygments==2.3.1
pyparsing==2.3.1
pytest==4.4.0
pytz==2018.9
requests==2.21.0
scandir==1.10.0
six==1.12.0
snowballstemmer==1.2.1
Sphinx==1.8.5
sphinx-bootstrap-theme==0.7.1
sphinxcontrib-websupport==1.1.0
typing==3.6.6
urllib3==1.24.1

Note: asv is installed locally as editable.

I am using "Python 2.7.16+".

@pv
Copy link
Collaborator

pv commented Sep 3, 2019 via email

@Alphare
Copy link
Contributor Author

Alphare commented Sep 4, 2019

I've checked out the main master branch and still have the same issue. Am I following the right procedure to run tests?

@pv
Copy link
Collaborator

pv commented Sep 4, 2019 via email

@kevingerman
Copy link

kevingerman commented Sep 5, 2019

I find that I have to specify the test directory, a glob pattern or the specific module that I want to use when running pytest from the command line with asv.

e.g.

pytest test
pytest test/test_benchmark*

@pv
Copy link
Collaborator

pv commented Sep 5, 2019

FWIW, for me it works out of the box:

$ pytest 
============================= test session starts ==============================
platform linux2 -- Python 2.7.16, pytest-4.6.5, py-1.8.0, pluggy-0.12.0
rootdir: /home/pauli/prj/scipy/asv, inifile: pytest.ini
collected 210 items                                                            
... tests run ok ...
$ pytest-3
Test session starts (platform: linux, Python 3.7.4, pytest 5.1.2, pytest-sugar 0.9.2)
rootdir: /home/pauli/prj/scipy/asv, inifile: pytest.ini
plugins: cov-2.7.1, leaks-0.3.0, sugar-0.9.2, timeout-1.3.3, xdist-1.27.0, rerunfailures-6.0, forked-1.0.1
collecting ... 
... tests run ok ...

@pv
Copy link
Collaborator

pv commented Sep 7, 2019

I guess you could also try from clean checkout, git clean -fdx etc., in case there are some old py/pyc files lying around.

@pv pv added the question Triaged as a question, not requiring action after answering label Sep 7, 2019
@Alphare
Copy link
Contributor Author

Alphare commented Sep 16, 2019

It was indeed some kind of local issue. Note @pv I'm not certain recommending to run git clean -fdx without a warning is such a good idea considering its destructive nature.

Thanks a lot!

@Alphare Alphare closed this as completed Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Triaged as a question, not requiring action after answering
Projects
None yet
Development

No branches or pull requests

3 participants