Skip to content

Commit

Permalink
feat(tests): add conditional markers for Byron tests
Browse files Browse the repository at this point in the history
Introduce ORDER5_BYRON and LONG_BYRON markers to conditionally apply
pytest marks based on the configuration. This change helps to avoid
setting priority for tests when the it is not needed, because the tests
run on setup where it is fast to respin the local testnet.

Also, add a new "noop" placeholder marker to the pyproject.toml file.
  • Loading branch information
mkoura committed Sep 30, 2024
1 parent 56f16db commit 1ae3454
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
6 changes: 6 additions & 0 deletions cardano_node_tests/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from cardano_node_tests.tests import issues
from cardano_node_tests.utils import cluster_nodes
from cardano_node_tests.utils import clusterlib_utils
from cardano_node_tests.utils import configuration
from cardano_node_tests.utils import pytest_utils
from cardano_node_tests.utils.versions import VERSIONS

Expand All @@ -18,6 +19,11 @@
MAX_INT64 = (2**63) - 1
MAX_UINT64 = (2**64) - 1

ORDER5_BYRON = (
pytest.mark.order(5) if "_fast" not in configuration.SCRIPTS_DIRNAME else pytest.mark.noop
)
LONG_BYRON = pytest.mark.long if "_fast" not in configuration.SCRIPTS_DIRNAME else pytest.mark.noop


_BLD_SKIP_REASON = ""
if VERSIONS.transaction_era != VERSIONS.cluster_era:
Expand Down
4 changes: 2 additions & 2 deletions cardano_node_tests/tests/test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ def check_epoch_length(cluster_obj: clusterlib.ClusterLib) -> None:
# It takes long time to setup the cluster instance (when starting from Byron).
# We mark the tests as "long" and set the highest priority, so the setup is done at the
# beginning of the testrun, instead of needing to respin a cluster that is already running.
@pytest.mark.order(5)
@pytest.mark.long
@common.ORDER5_BYRON
@common.LONG_BYRON
class TestBasic:
"""Basic tests for node configuration."""

Expand Down
4 changes: 2 additions & 2 deletions cardano_node_tests/tests/test_kes.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ class TestKES:
# It takes long time to setup the cluster instance (when starting from Byron).
# We mark the tests as "long" and set the highest priority, so the setup is done at the
# beginning of the testrun, instead of needing to respin a cluster that is already running.
@pytest.mark.order(5)
@pytest.mark.long
@common.ORDER5_BYRON
@common.LONG_BYRON
def test_expired_kes(
self,
cluster_kes: clusterlib.ClusterLib,
Expand Down
4 changes: 2 additions & 2 deletions cardano_node_tests/tests/test_pools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1776,8 +1776,8 @@ def test_pool_registration_deregistration(
# It takes long time to setup the cluster instance (when starting from Byron).
# We mark the tests as "long" and set the highest priority, so the setup is done at the
# beginning of the testrun, instead of needing to respin a cluster that is already running.
@pytest.mark.order(5)
@pytest.mark.long
@common.ORDER5_BYRON
@common.LONG_BYRON
class TestPoolCost:
"""Tests for stake pool cost."""

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,5 @@ markers = [
"upgrade: test(s) for upgrade testing",
"plutus: test(s) for plutus",
"disabled: temporarily disabled test(s)",
"noop: placeholder marker",
]

0 comments on commit 1ae3454

Please sign in to comment.