We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Dynamically requesting a fixture via some autouse fixture does not add it to request.fixturenames:
request.fixturenames
import pytest dynamic_called = False @pytest.fixture() def dynamic(): global dynamic_called dynamic_called = True @pytest.fixture(autouse=True) def autouse(request): request.getfixturevalue('dynamic') def test_foo(request): assert dynamic_called assert 'dynamic' in request.fixturenames
Test session starts (platform: linux, Python 3.6.6, pytest 3.7.3, pytest-sugar 0.9.1) Django settings: foo.settings (from environment variable) Using --randomly-seed=1536427658 rootdir: /project, inifile: setup.cfg plugins: django-3.4.2.dev4+g37723ff.d20180908, requests-mock-1.5.2, testmon-0.9.13, repeat-0.6.0, randomly-1.2.3, pdb-0.3.1, mock-1.10.0, forked-0.2, cov-2.5.1, asyncio-0.9.0, celery-4.2.1, xdist-1.22.6.dev1+g96af694.d20180828, sugar-0.9.1 ―――――――――――――――――――――――――――――――――――――――――― test_foo ―――――――――――――――――――――――――――――――――――――――――― tests/test_querycount.py:18: in test_foo assert 'dynamic' in request.fixturenames E AssertionError: assert 'dynamic' in ['_fail_for_invalid_template_variable', 'django_test_environment', 'django_db_blocker', '_django_setup_unittest', '_dj_autoclear_mailbox', '_django_clear_site_cache', ...] E + where ['_fail_for_invalid_template_variable', 'django_test_environment', 'django_db_blocker', '_django_setup_unittest', '_dj_autoclear_mailbox', '_django_clear_site_cache', ...] = <FixtureRequest for <Function 'test_foo'>>.fixturenames
I've noticed this with pytest-django, which uses an autouse fixture to handle the django_db mark.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Dynamically requesting a fixture via some autouse fixture does not add it to
request.fixturenames
:I've noticed this with pytest-django, which uses an autouse fixture to handle the django_db mark.
The text was updated successfully, but these errors were encountered: