refactor: split unrelated helpers out of tests/common - #3703
Merged
Merged
Conversation
Move the `skipif` conditions, parametrizations, the `XdSplits` enum and the Byron-specific marks from `tests/common.py` into a new `tests/markers.py`, so that `common.py` no longer mixes declarative pytest metadata with helper functions. Drop the unused `PARAM_OFFLINE_BUILD_METHOD` and privatize `COMPAT_ERAS` and `PLUTUSV3_UNUSABLE`, which have no users outside of the new module.
Move the helpers that create and fund payment addresses and pool users from `tests/common.py` into a new `tests/addrs_common.py`, together with the related `get_conway_address_deposit`.
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The extraction and call-site updates are mechanically consistent; only a minor private-method naming issue was identified.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Refactors the oversized tests/common.py into focused modules while updating all affected test call sites.
Changes:
- Extracts pytest markers and parametrizations into
tests/markers.py. - Extracts address and pool-user helpers into
tests/addrs_common.py. - Moves node consistency checks into
utils/node_consistency.py.
| File | Description |
|---|---|
cardano_node_tests/tests/common.py |
Retains shared test IDs, fixtures, constants, and small helpers. |
cardano_node_tests/tests/addrs_common.py |
Adds extracted address and pool-user helpers. |
cardano_node_tests/tests/markers.py |
Adds extracted pytest markers and parametrizations. |
cardano_node_tests/utils/node_consistency.py |
Adds extracted UTxO and fork consistency checks. |
cardano_node_tests/tests/delegation.py |
Updates address-deposit helper references. |
cardano_node_tests/tests/test_addr_registration.py |
Updates extracted helper and marker references. |
cardano_node_tests/tests/test_blocks.py |
Updates address helpers and xdist markers. |
cardano_node_tests/tests/test_chain_transactions.py |
Updates payment-address helper usage. |
cardano_node_tests/tests/test_configuration.py |
Updates era, Byron, and xdist markers. |
cardano_node_tests/tests/test_dbsync.py |
Updates xdist marker usage. |
cardano_node_tests/tests/test_delegation.py |
Updates address helpers, deposits, and markers. |
cardano_node_tests/tests/test_env_network_id.py |
Updates address and build marker references. |
cardano_node_tests/tests/test_kes.py |
Updates markers and node consistency helper usage. |
cardano_node_tests/tests/test_ledger_state.py |
Updates era marker usage. |
cardano_node_tests/tests/test_leios_blocks.py |
Updates testnet marker usage. |
cardano_node_tests/tests/test_metrics.py |
Updates era marker usage. |
cardano_node_tests/tests/test_mir_certs.py |
Updates pool-user and build marker references. |
cardano_node_tests/tests/test_mnemonic.py |
Updates era marker usage. |
cardano_node_tests/tests/test_native_tokens.py |
Updates address, marker, and consistency helper references. |
cardano_node_tests/tests/test_node_upgrade.py |
Updates address, pool-user, and build marker references. |
cardano_node_tests/tests/test_pool_saturation.py |
Updates xdist marker usage. |
cardano_node_tests/tests/test_pools.py |
Updates pool-user, deposit, and marker references. |
cardano_node_tests/tests/test_reconnect.py |
Updates address and testnet marker references. |
cardano_node_tests/tests/test_rollback.py |
Updates address and testnet marker references. |
cardano_node_tests/tests/test_scripts.py |
Updates address, marker, and consistency helper references. |
cardano_node_tests/tests/test_socket_path.py |
Updates address and build marker references. |
cardano_node_tests/tests/test_staking_no_rewards.py |
Updates address-deposit and build marker references. |
cardano_node_tests/tests/test_staking_rewards.py |
Updates address-deposit and testnet marker references. |
cardano_node_tests/tests/test_tx_basic.py |
Updates address, marker, and consistency helper references. |
cardano_node_tests/tests/test_tx_fees.py |
Updates address and deposit helper references. |
cardano_node_tests/tests/test_tx_many_utxos.py |
Updates payment-address helper usage. |
cardano_node_tests/tests/test_tx_mempool.py |
Updates address and xdist marker references. |
cardano_node_tests/tests/test_tx_metadata.py |
Updates address and build marker references. |
cardano_node_tests/tests/test_tx_negative.py |
Updates pool-user and build marker references. |
cardano_node_tests/tests/test_tx_unbalanced.py |
Updates address and build marker references. |
cardano_node_tests/tests/tests_plutus_v2/mint_raw.py |
Updates consistency helper usage. |
cardano_node_tests/tests/tests_plutus_v2/test_mint_build.py |
Updates address, markers, and consistency checks. |
cardano_node_tests/tests/tests_plutus_v2/test_mint_negative_build.py |
Updates address, markers, and consistency checks. |
cardano_node_tests/tests/tests_plutus_v2/test_mint_negative_raw.py |
Updates address and marker references. |
cardano_node_tests/tests/tests_plutus_v2/test_mint_raw.py |
Updates address, markers, and consistency checks. |
cardano_node_tests/tests/tests_plutus_v2/test_mint_secp256k1_build.py |
Updates address, markers, and consistency checks. |
cardano_node_tests/tests/tests_plutus_v2/test_mint_secp256k1_raw.py |
Updates address, markers, and consistency checks. |
cardano_node_tests/tests/tests_plutus_v2/test_spend_build.py |
Updates address and marker references. |
cardano_node_tests/tests/tests_plutus_v2/test_spend_collateral_build.py |
Updates address and marker references. |
cardano_node_tests/tests/tests_plutus_v2/test_spend_collateral_raw.py |
Updates address and marker references. |
cardano_node_tests/tests/tests_plutus_v2/test_spend_compat_build.py |
Updates address and marker references. |
cardano_node_tests/tests/tests_plutus_v2/test_spend_compat_raw.py |
Updates address helper usage. |
cardano_node_tests/tests/tests_plutus_v2/test_spend_datum_build.py |
Updates address and marker references. |
cardano_node_tests/tests/tests_plutus_v2/test_spend_datum_raw.py |
Updates address and marker references. |
cardano_node_tests/tests/tests_plutus_v2/test_spend_raw.py |
Updates address and marker references. |
cardano_node_tests/tests/tests_plutus_v2/test_spend_ref_inputs_build.py |
Updates address, markers, and consistency checks. |
cardano_node_tests/tests/tests_plutus_v2/test_spend_ref_inputs_raw.py |
Updates address, markers, and consistency checks. |
cardano_node_tests/tests/tests_plutus_v2/test_spend_ref_scripts_build.py |
Updates address and marker references. |
cardano_node_tests/tests/tests_plutus_v2/test_spend_ref_scripts_raw.py |
Updates address and marker references. |
cardano_node_tests/tests/tests_plutus_v2/test_spend_secp256k1_build.py |
Updates address, markers, and consistency checks. |
cardano_node_tests/tests/tests_plutus_v2/test_spend_secp256k1_raw.py |
Updates address and marker references. |
cardano_node_tests/tests/tests_plutus/test_delegation.py |
Updates address, deposit, and marker references. |
cardano_node_tests/tests/tests_plutus/test_lobster.py |
Updates address and build marker references. |
cardano_node_tests/tests/tests_plutus/test_mint_build.py |
Updates address, markers, and consistency checks. |
cardano_node_tests/tests/tests_plutus/test_mint_negative_build.py |
Updates address and marker references. |
cardano_node_tests/tests/tests_plutus/test_mint_negative_raw.py |
Updates address and marker references. |
cardano_node_tests/tests/tests_plutus/test_mint_raw.py |
Updates address, markers, and consistency checks. |
cardano_node_tests/tests/tests_plutus/test_spend_build.py |
Updates address, pool-user, and marker references. |
cardano_node_tests/tests/tests_plutus/test_spend_compat_build.py |
Updates address and marker references. |
cardano_node_tests/tests/tests_plutus/test_spend_compat_raw.py |
Updates address helper usage. |
cardano_node_tests/tests/tests_plutus/test_spend_datum_build.py |
Updates address, markers, and consistency checks. |
cardano_node_tests/tests/tests_plutus/test_spend_datum_raw.py |
Updates address, markers, and consistency checks. |
cardano_node_tests/tests/tests_plutus/test_spend_negative_build.py |
Updates address and marker references. |
cardano_node_tests/tests/tests_plutus/test_spend_negative_raw.py |
Updates address and marker references. |
cardano_node_tests/tests/tests_plutus/test_spend_raw.py |
Updates address and marker references. |
cardano_node_tests/tests/tests_plutus_v3/test_mint_build.py |
Updates address, pool-user, and marker references. |
cardano_node_tests/tests/tests_plutus_v3/test_spend_build.py |
Updates address and marker references. |
cardano_node_tests/tests/tests_conway/test_committee.py |
Updates address, pool-user, and marker references. |
cardano_node_tests/tests/tests_conway/test_constitution.py |
Updates pool-user and xdist marker references. |
cardano_node_tests/tests/tests_conway/test_conway.py |
Updates pool-user and marker references. |
cardano_node_tests/tests/tests_conway/test_drep.py |
Updates address, pool-user, and marker references. |
cardano_node_tests/tests/tests_conway/test_guardrails.py |
Updates address, pool-user, and marker references. |
cardano_node_tests/tests/tests_conway/test_hardfork.py |
Updates pool-user and xdist marker references. |
cardano_node_tests/tests/tests_conway/test_info.py |
Updates pool-user helper usage. |
cardano_node_tests/tests/tests_conway/test_no_confidence.py |
Updates pool-user and xdist marker references. |
cardano_node_tests/tests/tests_conway/test_offchain_voting_anchor.py |
Updates address and pool-user helper usage. |
cardano_node_tests/tests/tests_conway/test_pparam_update.py |
Updates address, pool-user, and marker references. |
cardano_node_tests/tests/tests_conway/test_treasury_donation.py |
Updates address, marker, and consistency helper references. |
cardano_node_tests/tests/tests_conway/test_treasury_withdrawals.py |
Updates address, pool-user, and marker references. |
cardano_node_tests/tests/tests_conway/test_update_plutusv2_builtins.py |
Updates address, pool-user, and xdist marker references. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Move `check_missing_utxos` and `fail_on_fork` from `tests/common.py` into a new `utils/node_consistency.py`. The functions have no pytest dependency and are usable as framework code. Privatize `get_nodes_missing_utxos` and `detect_fork`, which are called only by the two public functions.
mkoura
force-pushed
the
split_tests_common
branch
from
September 21, 2026 15:27
4774ca8 to
d055ce0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Over time, everything that was too test- or pytest-specific to live in
cardano_node_tests/utils/ended up incardano_node_tests/tests/common.py, andthe module grew into a collection of unrelated functionality. This splits the
three largest self-contained chunks into their own modules.
tests/common.pyshrinks from 734 to 211 lines. No behavior changes - the movesare pure renames of the qualifying module, plus the removal of dead code.
New modules
tests/markers.py- declarative pytest metadata only: theskipifconditions, the parametrizations, the
XdSplitsenum and the Byron-specificmarks.
tests/addrs_common.py- helpers that create and fund payment addresses andpool users, together with the related
get_conway_address_deposit.utils/node_consistency.py-check_missing_utxosandfail_on_fork. Thesehave no pytest dependency and are usable as framework code, so they go to
utils/rather than staying undertests/.What stays in
tests/common.pyTest IDs and cluster fixtures (
get_test_id,get_fixture_cluster_obj), theepoch interval constants, the paths and public URLs of the test data files, and
the remaining small helpers (
unique_time_str,hypothesis_settings,match_blocker,is_fee_in_interval,allow_unstable_error_messages).Removed / privatized
PARAM_OFFLINE_BUILD_METHOD, which had no users.COMPAT_ERAS,PLUTUSV3_UNUSABLE,get_nodes_missing_utxosanddetect_fork, which are used only within their new modules.No compatibility re-exports are left behind in
tests/common.py, so all callsites are updated in place. This is what makes the diff large; each commit is a
mechanical, reviewable rename of one group of symbols.