mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
Reuse common port-related test fixtures
Most Python-based system tests need to know which ports were assigned to a given test by bin/tests/system/get_ports.sh. This is currently handled by inspecting the values of various environment variables (set by bin/tests/system/run.sh) and passing the port numbers to Python scripts via pytest fixtures. However, this glue code has so far been copy-pasted into each system test using it, rather than reused. Since pytest also looks for conftest.py files in parent directories, move commonly used fixtures to bin/tests/system/conftest.py. Set the scope of all the moved fixtures to "session" as their return values are only based on environment variables, so there is no point in recreating them for every test requesting them. Adjust test code accordingly.
This commit is contained in:
@@ -11,7 +11,6 @@
|
||||
# See the COPYRIGHT file distributed with this work for additional
|
||||
# information regarding copyright ownership.
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
@@ -36,8 +35,3 @@ def gnutls_cli_executable():
|
||||
pytest.skip('gnutls-cli does not support the --logfile option')
|
||||
|
||||
return executable
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def named_tlsport():
|
||||
return int(os.environ.get('TLSPORT', '853'))
|
||||
|
Reference in New Issue
Block a user