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

PYTEST_PLUGINS does not mark files for rewriting #2185

Closed
nicoddemus opened this Issue Jan 11, 2017 · 1 comment

Comments

Projects
None yet
1 participant
@nicoddemus
Member

nicoddemus commented Jan 11, 2017

Minimal example:

# contents of plugin.py
# can be an empty file

# contents of test_foo.py
import plugin

pytest_plugins = ['plugin']

def test():
    pass

Setting the environment variable PYTEST_PLUGINS=plugin to the test's directory and configuring PYTHONPATH so the plugin module can be imported, pytest will warn about plugin already been imported and couldn't be re-written:

$ pytest -q
.
=========================== pytest-warning summary ============================
WP1 None Module already imported so can not be re-written: plugin
1 passed, 1 pytest-warnings in 0.01 seconds

Pytest should consider PYTEST_PLUGINS automatically for rewriting.

@nicoddemus nicoddemus self-assigned this Jan 11, 2017

@nicoddemus

This comment has been minimized.

Member

nicoddemus commented Jan 11, 2017

This was discovered in a more complicated case where both PYTEST_PLUGINS and pytest_plugins were set for the same module.

nicoddemus added a commit to nicoddemus/pytest that referenced this issue Jan 11, 2017

nicoddemus added a commit to nicoddemus/pytest that referenced this issue Jan 11, 2017

nicoddemus added a commit to nicoddemus/pytest that referenced this issue Jan 11, 2017

This was referenced Mar 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment