|
1 |
| -#!/usr/bin/python3 |
2 |
| - |
3 | 1 | # Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
4 | 2 | #
|
5 | 3 | # SPDX-License-Identifier: MPL-2.0
|
|
12 | 10 | # information regarding copyright ownership.
|
13 | 11 |
|
14 | 12 | import os
|
15 |
| - |
16 | 13 | import pytest
|
17 | 14 |
|
18 | 15 |
|
19 |
| -@pytest.fixture(scope="session") |
| 16 | +# ======================= LEGACY=COMPATIBLE FIXTURES ========================= |
| 17 | +# The following fixtures are designed to work with both pytest system test |
| 18 | +# runner and the legacy system test framework. |
| 19 | + |
| 20 | + |
| 21 | +@pytest.fixture(scope="module") |
20 | 22 | def named_port():
|
21 | 23 | return int(os.environ.get("PORT", default=5300))
|
22 | 24 |
|
23 | 25 |
|
24 |
| -@pytest.fixture(scope="session") |
| 26 | +@pytest.fixture(scope="module") |
25 | 27 | def named_tlsport():
|
26 | 28 | return int(os.environ.get("TLSPORT", default=8853))
|
27 | 29 |
|
28 | 30 |
|
29 |
| -@pytest.fixture(scope="session") |
| 31 | +@pytest.fixture(scope="module") |
30 | 32 | def named_httpsport():
|
31 | 33 | return int(os.environ.get("HTTPSPORT", default=4443))
|
32 | 34 |
|
33 | 35 |
|
34 |
| -@pytest.fixture(scope="session") |
| 36 | +@pytest.fixture(scope="module") |
35 | 37 | def control_port():
|
36 | 38 | return int(os.environ.get("CONTROLPORT", default=9953))
|
| 39 | + |
| 40 | + |
| 41 | +# ======================= PYTEST SYSTEM TEST RUNNER ========================== |
| 42 | +# From this point onward, any setting, fixtures or functions only apply to the |
| 43 | +# new pytest runner. Ideally, these would be in a separate file. However, due |
| 44 | +# to how pytest works and how it's used by the legacy runner, the best approach |
| 45 | +# is to have everything in this file to avoid duplication and set the |
| 46 | +# LEGACY_TEST_RUNNER if pytest is executed from the legacy framework. |
| 47 | +# |
| 48 | +# FUTURE: Once legacy runner is no longer supported, remove the env var and |
| 49 | +# don't branch the code. |
| 50 | + |
| 51 | +if os.getenv("LEGACY_TEST_RUNNER", "0") == "0": |
| 52 | + pass # will be implemented in followup commits |
0 commit comments