Change test suite web server (gunicorn) launch to a proper pytest fixture #3002
+70
−96
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This cleans up the test suite somewhat, by changing how gunicorn is launched to provide a fully operational NAV web ui for the test suite.
Gunicorn is needed both by the integration and the functional test suites, but its launch was duplicated in both suites'
conftest.py
files. Also, as part of thepytest_configure()
andpytest_unconfigure()
functions of those modules, the gunicorn server would always be launches on every test session, regardless of which tests were selected.This changes the mechanism to properly function as a pytest fixture, which means that tests can now explicitly declare a dependency on the gunicorn test web server. This ensures it will only ever be launched when tests that use it are selected.
The PR ensures existing tests that need the web server are made dependent on the new fixture, and removes a bit of cruft in the surrounding code as well.
Anti-cruft measures inclue removing test suite redundancies by factoring out redundant setup code and moving it to the top-level
tests/conftest.py
file. This was in some ways necessary for the test suite to continue working.This was extracted and adapted from #2675.