question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pytest plugin runs even when irrelevant

See original GitHub issue

Describe 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

  1. Install nameko
  2. Go to a directory unrelated to nameko
  3. 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:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
palfreycommented, Dec 11, 2020

Adding addopts = -p no:nameko to my pytest.ini at least worked around this

1reaction
mattbennettcommented, Jan 7, 2021

Thanks, 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 in testing or similar install_extras for folks that want to write tests for their Nameko services.

Thanks again for raising this.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found