-
-
Notifications
You must be signed in to change notification settings - Fork 463
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 plugin runs even when irrelevant #703
Comments
Adding |
Thanks for reporting this and sorry it's been a couple of months without a response. The bit that's screwing you up here is the Nameko, and all services built with Nameko, need the monkey patch to be applied in their test suites, as early as possible, before any imports. AFAIK there is no other suitable hook in pytest for this. This situation will occur when you have PyTest and Nameko installed, but are not using Eventlet (and by extension not using Nameko either). I can't think of any better workaround than @palfrey has suggested. |
pytest plugins typically only register, but dont do anything, unless there is some explicit clue that the plugin is needed. The correct place to do extremely early imports is in per-project At the very least you should move "Nameko test rig hacks" out of the main Nameko library, into a separately installable library, as it is not needed by all Nameko users - it is only needed by Nameko users that are running tests. If it is only initialising eventlet, you might create a Until this automatic pollution of the pytest environment is fixed, nameko is not suitable for inclusion in distros. i.e. I cant submit https://build.opensuse.org/package/show/home:jayvdb:py-new/python-nameko |
Thanks, you are completely right. Forcing all users (that run tests) to add something to their project It can be automatically included in Nameko's Thanks again for raising this. |
(resolves nameko#703) * warns users if the monkeypatch is not applied * suggests using pytest-eventlet as an alternative
(resolves nameko#703) * warns users if the monkeypatch is not applied * suggests using pytest-eventlet as an alternative # Conflicts: # nameko/testing/pytest.py
* remove automatic monkey-patching (resolves #703) * warns users if the monkeypatch is not applied * suggests using pytest-eventlet as an alternative * static * add nameko test command + update warning + move nameko run patch into cli so it is earlier and more explicit * add __main__ entrypoint so CI can run nameko test * always continue on error for debug * 0.25.1 is oldest supported eventlet on py37+ we need eventlet/eventlet#584 * Revert "always continue on error for debug" This reverts commit e6fc162. * don't need pytest-eventlet plugin anymore
* remove automatic monkey-patching (resolves #703) * warns users if the monkeypatch is not applied * suggests using pytest-eventlet as an alternative # Conflicts: # nameko/testing/pytest.py * static * add nameko test command + update warning + move nameko run patch into cli so it is earlier and more explicit * add __main__ entrypoint so CI can run nameko test * 0.25.1 is oldest supported eventlet on py37+ we need eventlet/eventlet#584 * don't need pytest-eventlet plugin anymore
This has been fixed in Nameko 2.14.0 and 3.0.0rc10, now released. |
Describe the bug
pytest plugin runs even when irrelevant.
To Reproduce
pytest --help
Expected behavior
nameko plugin should expose its options, but otherwise do nothing.
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: