Skip to content

pytest + plugin + __init__.py as argument = error #7763

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

Closed
akeeman opened this issue Sep 17, 2020 · 2 comments
Closed

pytest + plugin + __init__.py as argument = error #7763

akeeman opened this issue Sep 17, 2020 · 2 comments

Comments

@akeeman
Copy link

akeeman commented Sep 17, 2020

Apparently there has been some struggle already with __init__.py files, and I'd like to add a case to that, that still is broken:

Try running a pytest, enable a plugin (I tried it with flakes and black), and pass an __init__.py file as file argument (may be among others), e.g.

$ pytest --flakes my_repo/__init__.py
=============================== test session starts ================================
platform linux -- Python 3.8.0, pytest-6.0.2, py-1.9.0, pluggy-0.13.1
rootdir: /path/to/my_repo, configfile: pyproject.toml
plugins: flakes-4.0.1
collected 0 items / 1 error                                                        

====================================== ERRORS ======================================
__________________________ ERROR collecting test session ___________________________
.venv/lib/python3.8/site-packages/_pytest/runner.py:294: in from_call
    result = func()  # type: Optional[_T]
.venv/lib/python3.8/site-packages/_pytest/runner.py:324: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
.venv/lib/python3.8/site-packages/_pytest/main.py:576: in collect
    yield from self._collect(fspath, parts)
.venv/lib/python3.8/site-packages/_pytest/main.py:662: in _collect
    yield next(iter(m[0].collect()))
.venv/lib/python3.8/site-packages/_pytest/nodes.py:457: in collect
    raise NotImplementedError("abstract")
E   NotImplementedError: abstract
============================= short test summary info ==============================
ERROR  - NotImplementedError: abstract
!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!
================================= 1 error in 0.12s =================================

It should have something to do with the block here.

@akeeman akeeman changed the title pytest + plugin + single __init__.py file = error pytest + plugin + __init__.py as argument = error Sep 17, 2020
@akeeman
Copy link
Author

akeeman commented Sep 18, 2020

I think this should be seen purely as a plugin error, so let's fix it there.

@dmtucker
Copy link

I suspect this may no longer reproduce in 6.2.0+ because of 66311ff#diff-689af6a98fad782f87c1473a3758c720d3e23ea0ecdc89617df250b2a093c6a8L778-R785

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants