[9.18] new: test: Add nsX fixtures to pytest

The nsX are utility fixtures which can be used instead of the servers
fixture, which requires longer syntax(i.e. servers["nsX"]).

---

This MR is basically backporting pytest utility fixtures which were introduced to newer branches in !10717. This is a minimal change which only aims to facilitate easier test backports to ~"v9.18" in the future, without changing any of the existing tests.

Merge branch 'nicki/pytest-nsX-fixtures-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!11015
This commit is contained in:
Nicki Křížek 2025-09-25 17:18:11 +02:00
commit b49954e458

View file

@ -717,7 +717,7 @@ def system_test(
request.node.stash[FIXTURE_OK] = True
@pytest.fixture
@pytest.fixture(scope="module")
def servers(ports, system_test_dir):
instances = {}
for entry in system_test_dir.rglob("*"):
@ -733,3 +733,53 @@ def servers(ports, system_test_dir):
except ValueError:
continue
return instances
@pytest.fixture(scope="module")
def ns1(servers):
return servers["ns1"]
@pytest.fixture(scope="module")
def ns2(servers):
return servers["ns2"]
@pytest.fixture(scope="module")
def ns3(servers):
return servers["ns3"]
@pytest.fixture(scope="module")
def ns4(servers):
return servers["ns4"]
@pytest.fixture(scope="module")
def ns5(servers):
return servers["ns5"]
@pytest.fixture(scope="module")
def ns6(servers):
return servers["ns6"]
@pytest.fixture(scope="module")
def ns7(servers):
return servers["ns7"]
@pytest.fixture(scope="module")
def ns8(servers):
return servers["ns8"]
@pytest.fixture(scope="module")
def ns9(servers):
return servers["ns9"]
@pytest.fixture(scope="module")
def ns10(servers):
return servers["ns10"]