pytest plugin runs even when irrelevant
See original GitHub issueDescribe the bug pytest plugin runs even when irrelevant.
pytest --help
..
File "/usr/lib/python3.8/site-packages/nameko/testing/pytest.py", line 80, in pytest_load_initial_conftests
eventlet.monkey_patch()
File "/usr/lib/python3.8/site-packages/eventlet/patcher.py", line 271, in monkey_patch
_green_existing_locks()
File "/usr/lib/python3.8/site-packages/eventlet/patcher.py", line 362, in _green_existing_locks
if isinstance(obj, rlock_type):
File "/usr/lib/python3.8/site-packages/django/utils/functional.py", line 224, in inner
self._setup()
File "/usr/lib/python3.8/site-packages/django/conf/__init__.py", line 57, in _setup
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Requested settings, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
To Reproduce
- Install nameko
- Go to a directory unrelated to nameko
- run
pytest --help
Expected behavior nameko plugin should expose its options, but otherwise do nothing.
Environment (please complete the following information):
- Nameko version: 2.13.0
- Python version: 3.8
- OS: Linux
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
BUG: pytest v3.10.0 collects and runs all tests twice ... - GitHub
All tests are being collected and run twice on v3.10.0. The text was updated successfully ... e.g. I think the python plugin should...
Read more >pytest fixtures: explicit, modular, scalable
Fixtures defined in a conftest.py can be used by any test in that package without needing to import them (pytest will automatically discover...
Read more >pytest Documentation - Read the Docs
The [100%] refers to the overall progress of running all test cases. ... A full module dotted name, for example myproject.plugins.
Read more >Pytest and coverage: why do coverage results vary with ...
It looks like you may have the pytest-cov plugin enabled, and you are running py.test under coverage. You should pick one technique or...
Read more >Effective Python Testing With Pytest
It'll even run your existing tests out of the box, ... Although some pytest plugins focus on specific frameworks like Django, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Adding
addopts = -p no:nameko
to mypytest.ini
at least worked around thisThanks, you are completely right.
Forcing all users (that run tests) to add something to their project
conftest.py
would be clunky and jarring for lots of existing users, but I like the idea of moving the monkey-patch to a different library.It can be automatically included in Nameko’s
dev
dependencies, and appear as intesting
or similarinstall_extras
for folks that want to write tests for their Nameko services.Thanks again for raising this.