From f7c0dc36bed1e002c5768459d0cb6b93f1050c55 Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Tue, 24 Aug 2021 14:57:56 -0700 Subject: [PATCH] skip running heavy randomized tests in CI --- .../eth2spec/test/altair/random/test_random.py | 17 +++++++++++++++++ tests/core/pyspec/eth2spec/test/context.py | 11 +++++++++++ .../eth2spec/test/phase0/random/test_random.py | 17 +++++++++++++++++ tests/generators/random/generate.py | 2 ++ 4 files changed, 47 insertions(+) diff --git a/tests/core/pyspec/eth2spec/test/altair/random/test_random.py b/tests/core/pyspec/eth2spec/test/altair/random/test_random.py index c7780925d..d022c2ca1 100644 --- a/tests/core/pyspec/eth2spec/test/altair/random/test_random.py +++ b/tests/core/pyspec/eth2spec/test/altair/random/test_random.py @@ -9,6 +9,7 @@ from eth2spec.test.context import ( misc_balances_in_default_range_with_many_validators, with_phases, zero_activation_threshold, + only_generator, ) from eth2spec.test.context import ( always_bls, @@ -21,6 +22,7 @@ from eth2spec.test.utils.random import ( ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([ALTAIR]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -46,6 +48,7 @@ def test_randomized_0(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([ALTAIR]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -71,6 +74,7 @@ def test_randomized_1(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([ALTAIR]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -96,6 +100,7 @@ def test_randomized_2(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([ALTAIR]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -121,6 +126,7 @@ def test_randomized_3(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([ALTAIR]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -146,6 +152,7 @@ def test_randomized_4(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([ALTAIR]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -171,6 +178,7 @@ def test_randomized_5(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([ALTAIR]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -196,6 +204,7 @@ def test_randomized_6(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([ALTAIR]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -221,6 +230,7 @@ def test_randomized_7(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([ALTAIR]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -246,6 +256,7 @@ def test_randomized_8(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([ALTAIR]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -271,6 +282,7 @@ def test_randomized_9(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([ALTAIR]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -296,6 +308,7 @@ def test_randomized_10(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([ALTAIR]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -321,6 +334,7 @@ def test_randomized_11(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([ALTAIR]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -346,6 +360,7 @@ def test_randomized_12(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([ALTAIR]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -371,6 +386,7 @@ def test_randomized_13(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([ALTAIR]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -396,6 +412,7 @@ def test_randomized_14(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([ALTAIR]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, diff --git a/tests/core/pyspec/eth2spec/test/context.py b/tests/core/pyspec/eth2spec/test/context.py index f6f120d55..346cdc8f1 100644 --- a/tests/core/pyspec/eth2spec/test/context.py +++ b/tests/core/pyspec/eth2spec/test/context.py @@ -456,6 +456,17 @@ with_altair_and_later = with_phases([ALTAIR, MERGE]) with_merge_and_later = with_phases([MERGE]) # TODO: include sharding when spec stabilizes. +def only_generator(reason): + def _decorator(inner): + def _wrapper(*args, **kwargs): + if is_pytest: + dump_skipping_message(reason) + return None + return inner(*args, **kwargs) + return _wrapper + return _decorator + + def fork_transition_test(pre_fork_name, post_fork_name, fork_epoch=None): """ A decorator to construct a "transition" test from one fork of the eth2 spec diff --git a/tests/core/pyspec/eth2spec/test/phase0/random/test_random.py b/tests/core/pyspec/eth2spec/test/phase0/random/test_random.py index 95dfeaeaf..5bb8c3791 100644 --- a/tests/core/pyspec/eth2spec/test/phase0/random/test_random.py +++ b/tests/core/pyspec/eth2spec/test/phase0/random/test_random.py @@ -9,6 +9,7 @@ from eth2spec.test.context import ( misc_balances_in_default_range_with_many_validators, with_phases, zero_activation_threshold, + only_generator, ) from eth2spec.test.context import ( always_bls, @@ -21,6 +22,7 @@ from eth2spec.test.utils.random import ( ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([PHASE0]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -46,6 +48,7 @@ def test_randomized_0(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([PHASE0]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -71,6 +74,7 @@ def test_randomized_1(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([PHASE0]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -96,6 +100,7 @@ def test_randomized_2(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([PHASE0]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -121,6 +126,7 @@ def test_randomized_3(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([PHASE0]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -146,6 +152,7 @@ def test_randomized_4(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([PHASE0]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -171,6 +178,7 @@ def test_randomized_5(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([PHASE0]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -196,6 +204,7 @@ def test_randomized_6(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([PHASE0]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -221,6 +230,7 @@ def test_randomized_7(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([PHASE0]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -246,6 +256,7 @@ def test_randomized_8(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([PHASE0]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -271,6 +282,7 @@ def test_randomized_9(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([PHASE0]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -296,6 +308,7 @@ def test_randomized_10(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([PHASE0]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -321,6 +334,7 @@ def test_randomized_11(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([PHASE0]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -346,6 +360,7 @@ def test_randomized_12(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([PHASE0]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -371,6 +386,7 @@ def test_randomized_13(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([PHASE0]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, @@ -396,6 +412,7 @@ def test_randomized_14(spec, state): ) +@only_generator("randomized test for broad coverage, not point-to-point CI") @with_phases([PHASE0]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators, diff --git a/tests/generators/random/generate.py b/tests/generators/random/generate.py index 2f6b306d1..3f34a6bc0 100644 --- a/tests/generators/random/generate.py +++ b/tests/generators/random/generate.py @@ -157,6 +157,7 @@ from eth2spec.test.context import ( misc_balances_in_default_range_with_many_validators, with_phases, zero_activation_threshold, + only_generator, ) from eth2spec.test.context import ( always_bls, @@ -169,6 +170,7 @@ from eth2spec.test.utils.random import ( )""" test_template = """ +@only_generator(\"randomized test for broad coverage, not point-to-point CI\") @with_phases([{phase}]) @with_custom_state( balances_fn=misc_balances_in_default_range_with_many_validators,