Skip to content

Commit f3c7637

Browse files
authored
Merge pull request #1197 from mkoura/same_eras_skip
Unify skips; test also on Babbage in addition to Alonzo
2 parents 58b2cee + 74ea51e commit f3c7637

8 files changed

+14
-35
lines changed

cardano_node_tests/tests/common.py

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
f"and TX era '{VERSIONS.transaction_era_name}'"
1919
)
2020

21+
SAME_ERAS = (
22+
VERSIONS.cluster_era >= VERSIONS.DEFAULT_CLUSTER_ERA
23+
and VERSIONS.transaction_era == VERSIONS.cluster_era
24+
)
25+
ERAS_SKIP_MSG = "meant to run with default era or higher, where cluster era == Tx era"
26+
2127

2228
class PytestTest(NamedTuple):
2329
test_function: str

cardano_node_tests/tests/test_cli.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,7 @@ def test_pretty_utxo(
170170
assert utxo_out == expected_out
171171

172172
@allure.link(helpers.get_vcs_link())
173-
@pytest.mark.skipif(
174-
VERSIONS.transaction_era != VERSIONS.DEFAULT_TX_ERA,
175-
reason="different TX eras doesn't affect this test",
176-
)
173+
@pytest.mark.skipif(not common.SAME_ERAS, reason=common.ERAS_SKIP_MSG)
177174
@pytest.mark.testnets
178175
def test_tx_view(self, cluster: clusterlib.ClusterLib):
179176
"""Check that the output of `transaction view` is as expected."""

cardano_node_tests/tests/test_configuration.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
from cardano_node_tests.utils import helpers
1717
from cardano_node_tests.utils import locking
1818
from cardano_node_tests.utils import temptools
19-
from cardano_node_tests.utils.versions import VERSIONS
2019

2120
LOGGER = logging.getLogger(__name__)
2221

@@ -114,10 +113,7 @@ def check_epoch_length(cluster_obj: clusterlib.ClusterLib) -> None:
114113

115114

116115
@pytest.mark.order(5)
117-
@pytest.mark.skipif(
118-
VERSIONS.transaction_era != VERSIONS.DEFAULT_TX_ERA,
119-
reason="different TX eras doesn't affect this test, pointless to run",
120-
)
116+
@pytest.mark.skipif(not common.SAME_ERAS, reason=common.ERAS_SKIP_MSG)
121117
@pytest.mark.long
122118
class TestBasic:
123119
"""Basic tests for node configuration."""

cardano_node_tests/tests/test_kes.py

+1-8
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,7 @@
4141
NUM_OF_EPOCHS += 1
4242

4343

44-
pytestmark = pytest.mark.skipif(
45-
not (
46-
VERSIONS.cluster_era
47-
== VERSIONS.transaction_era
48-
== (VERSIONS.LAST_KNOWN_ERA or VERSIONS.DEFAULT_CLUSTER_ERA)
49-
),
50-
reason="meant to run only with the latest or default cluster era and transaction era",
51-
)
44+
pytestmark = pytest.mark.skipif(not common.SAME_ERAS, reason=common.ERAS_SKIP_MSG)
5245

5346

5447
@pytest.fixture

cardano_node_tests/tests/test_ledger_state.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from cardano_node_tests.utils import cluster_nodes
1515
from cardano_node_tests.utils import clusterlib_utils
1616
from cardano_node_tests.utils import helpers
17-
from cardano_node_tests.utils.versions import VERSIONS
1817

1918
LOGGER = logging.getLogger(__name__)
2019

@@ -33,11 +32,8 @@ class TestLedgerState:
3332
"""Basic tests for ledger state."""
3433

3534
@allure.link(helpers.get_vcs_link())
36-
@pytest.mark.skipif(
37-
VERSIONS.transaction_era != VERSIONS.DEFAULT_TX_ERA,
38-
reason="different TX eras doesn't affect this test, pointless to run",
39-
)
4035
@pytest.mark.order(-1)
36+
@pytest.mark.skipif(not common.SAME_ERAS, reason=common.ERAS_SKIP_MSG)
4137
@pytest.mark.testnets
4238
@pytest.mark.smoke
4339
def test_stake_snapshot(self, cluster: clusterlib.ClusterLib): # noqa: C901

cardano_node_tests/tests/test_metrics.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import requests
77
from cardano_clusterlib import clusterlib
88

9+
from cardano_node_tests.tests import common
910
from cardano_node_tests.utils import cluster_nodes
1011
from cardano_node_tests.utils import helpers
1112
from cardano_node_tests.utils import model_ekg
@@ -125,10 +126,7 @@ def test_available_metrics(
125126
assert metrics_keys == self.EXPECTED_METRICS, "Metrics differ"
126127

127128

128-
@pytest.mark.skipif(
129-
VERSIONS.transaction_era != VERSIONS.DEFAULT_TX_ERA,
130-
reason="different TX eras doesn't affect this test, pointless to run",
131-
)
129+
@pytest.mark.skipif(not common.SAME_ERAS, reason=common.ERAS_SKIP_MSG)
132130
class TestEKG:
133131
"""EKG metrics tests."""
134132

cardano_node_tests/tests/test_native_tokens.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -2125,12 +2125,9 @@ def test_minting_amount_above_the_allowed(
21252125
assert "the number exceeds the max bound" in str(excinfo.value)
21262126

21272127

2128+
@pytest.mark.skipif(not common.SAME_ERAS, reason=common.ERAS_SKIP_MSG)
21282129
@pytest.mark.testnets
21292130
@pytest.mark.smoke
2130-
@pytest.mark.skipif(
2131-
VERSIONS.transaction_era != VERSIONS.DEFAULT_TX_ERA,
2132-
reason="runs only with default TX era",
2133-
)
21342131
class TestCLITxOutSyntax:
21352132
"""Tests of syntax for specifying muti-asset values and txouts."""
21362133

cardano_node_tests/tests/test_protocol.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
from cardano_node_tests.tests import common
1010
from cardano_node_tests.utils import helpers
11-
from cardano_node_tests.utils.versions import VERSIONS
1211

1312
LOGGER = logging.getLogger(__name__)
1413

@@ -43,12 +42,9 @@
4342
)
4443

4544

45+
@pytest.mark.skipif(not common.SAME_ERAS, reason=common.ERAS_SKIP_MSG)
4646
@pytest.mark.testnets
4747
@pytest.mark.smoke
48-
@pytest.mark.skipif(
49-
VERSIONS.transaction_era != VERSIONS.DEFAULT_TX_ERA,
50-
reason="different TX eras doesn't affect this test, pointless to run",
51-
)
5248
class TestProtocol:
5349
"""Basic tests for protocol."""
5450

0 commit comments

Comments
 (0)