Defer server side imports in functional tests - #1496
Conversation
|
Note: Adding pulp_rpm to my oci-env had the side effect of fixing my local test runs. |
|
In pulp_rpm there's a pytest entry point here that loads the constants file and in that constants file, they are calling django.setup(). |
|
A couple alternatives to this change: call |
2b19403 to
e0a0bb6
Compare
The package signing tests imported AptPackageSigningService at module scope, which requires django.setup() to have run. That only happened as a side effect of the pytest-django plugin, which is declared in unittest_requirements.txt, so collection failed for anyone installing only functest_requirements.txt. Route the signature check through a session fixture depending on django.setup(), which is how pulpcore initializes Django for functional tests. Adding pytest-django to functest_requirements.txt would also work, but it drags database fixtures into an HTTP only suite and makes Django mandatory for every functional test run. Assisted-by: GitHub Copilot
e0a0bb6 to
58bc71a
Compare
The package signing tests imported AptPackageSigningService at module scope, which requires django.setup() to have run. That only happened as a side effect of the pytest-django plugin, which is declared in unittest_requirements.txt, so collection failed for anyone installing only functest_requirements.txt.
Route the signature check through a session fixture depending on
django.setup(), which is how pulpcore initializes Django for functional tests. Adding pytest-django to functest_requirements.txt would also work, but it drags database fixtures into an HTTP only suite and makes Django mandatory for every functional test run.Assisted-by: GitHub Copilot