mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
chg: test: Move requirement checks to pytest_configure hook
This leads to nicer logging if requirements aren't met. Merge branch 'stepan/dont-run-system-tests-without-requirements' into 'main' See merge request isc-projects/bind9!11551
This commit is contained in:
commit
3e32c55213
1 changed files with 17 additions and 16 deletions
|
|
@ -34,13 +34,6 @@ import isctest
|
|||
# Silence warnings caused by passing a pytest fixture to another fixture.
|
||||
# pylint: disable=redefined-outer-name
|
||||
|
||||
if sys.version_info[1] < 10:
|
||||
raise RuntimeError("Python 3.10 or newer is required to run system tests.")
|
||||
|
||||
isctest.log.init_conftest_logger()
|
||||
isctest.log.avoid_duplicated_logs()
|
||||
isctest.vars.init_vars()
|
||||
|
||||
# ----------------------- Globals definition -----------------------------
|
||||
|
||||
FILE_DIR = os.path.abspath(Path(__file__).parent)
|
||||
|
|
@ -56,18 +49,26 @@ PRIORITY_TESTS_RE = Re("|".join(PRIORITY_TESTS))
|
|||
SYSTEM_TEST_NAME_RE = Re(f"{SYSTEM_TEST_DIR_GIT_PATH}" + r"/([^/]+)")
|
||||
SYMLINK_REPLACEMENT_RE = Re(r"/tests_(.*)\.py")
|
||||
|
||||
# ----------------------- Global requirements ----------------------------
|
||||
|
||||
isctest.check.is_executable(isctest.vars.ALL["PYTHON"], "Python interpreter required")
|
||||
isctest.check.is_executable(isctest.vars.ALL["PERL"], "Perl interpreter required")
|
||||
isctest.check.is_executable(
|
||||
isctest.vars.ALL["FEATURETEST"],
|
||||
"Run this first: ninja -C build system-test-dependencies",
|
||||
)
|
||||
|
||||
# --------------------------- pytest hooks -------------------------------
|
||||
|
||||
|
||||
def pytest_configure(config): # pylint: disable=unused-argument
|
||||
if sys.version_info < (3, 10):
|
||||
raise RuntimeError("Python 3.10 or newer is required to run system tests.")
|
||||
|
||||
isctest.log.init_conftest_logger()
|
||||
isctest.log.avoid_duplicated_logs()
|
||||
isctest.check.is_executable(
|
||||
isctest.vars.ALL["FEATURETEST"],
|
||||
"Run this first: ninja -C build system-test-dependencies",
|
||||
)
|
||||
isctest.vars.init_vars()
|
||||
isctest.check.is_executable(
|
||||
isctest.vars.ALL["PYTHON"], "Python interpreter required"
|
||||
)
|
||||
isctest.check.is_executable(isctest.vars.ALL["PERL"], "Perl interpreter required")
|
||||
|
||||
|
||||
def pytest_addoption(parser):
|
||||
parser.addoption(
|
||||
"--noclean",
|
||||
|
|
|
|||
Loading…
Reference in a new issue