File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change 27
27
INTEGRATION_MARKER = 'integration'
28
28
MAINNET_MARKER = 'mainnet'
29
29
TESTNET_MARKER = 'testnet'
30
+ FORK_MARKER = 'fork'
31
+
32
+ INTEGRATION_TESTS_MODIFICATORS_MARKERS = {
33
+ MAINNET_MARKER ,
34
+ TESTNET_MARKER ,
35
+ FORK_MARKER ,
36
+ }
30
37
31
38
DUMMY_ADDRESS = "0x0000000000000000000000000000000000000000"
32
39
40
47
def check_test_marks_compatibility (request ):
41
48
all_test_markers = {x .name for x in request .node .iter_markers ()}
42
49
43
- if not all_test_markers :
44
- pytest .fail ('Test must be marked.' )
50
+ if not all_test_markers or not { UNIT_MARKER , INTEGRATION_MARKER } & all_test_markers :
51
+ pytest .fail ('Test must be marked with at least one marker, e.g. @pytest.mark.unit or @pytest.mark.integration .' )
45
52
46
- elif UNIT_MARKER in all_test_markers and {MAINNET_MARKER , TESTNET_MARKER , INTEGRATION_MARKER } & all_test_markers :
53
+ elif (
54
+ UNIT_MARKER in all_test_markers
55
+ and {INTEGRATION_MARKER }.union (INTEGRATION_TESTS_MODIFICATORS_MARKERS ) & all_test_markers
56
+ ):
47
57
pytest .fail ('Test can not be both unit and integration at the same time.' )
48
58
49
- elif {MAINNET_MARKER , TESTNET_MARKER } & all_test_markers and INTEGRATION_MARKER not in all_test_markers :
50
- pytest .fail ('Test can not be run on mainnet or testnet without integration marker.' )
59
+ elif INTEGRATION_TESTS_MODIFICATORS_MARKERS & all_test_markers and INTEGRATION_MARKER not in all_test_markers :
60
+ pytest .fail (
61
+ f'Test can not be run with { INTEGRATION_TESTS_MODIFICATORS_MARKERS } markers without @pytest.mark.integration.'
62
+ )
51
63
52
64
53
65
@pytest .fixture (autouse = True )
You can’t perform that action at this time.
0 commit comments