File tree Expand file tree Collapse file tree 3 files changed +5
-51
lines changed Expand file tree Collapse file tree 3 files changed +5
-51
lines changed Original file line number Diff line number Diff line change @@ -414,7 +414,7 @@ jobs:
414
414
--cov flowmachine/ \
415
415
--cov-report xml \
416
416
--cov-report term \
417
- --durations=10
417
+ --durations=50
418
418
- store_test_results :
419
419
path : test_results
420
420
- run :
Original file line number Diff line number Diff line change @@ -27,38 +27,15 @@ def pytest_configure(config):
27
27
)
28
28
29
29
30
- def get_string_with_test_parameter_values (item ):
31
- """
32
- If `item` corresponds to a parametrized pytest test, return a string
33
- containing the parameter values. Otherwise return an empty string.
34
- """
35
- if "parametrize" in item .keywords :
36
- m = re .search (
37
- "(\[[^\]]*\])$" , item .name
38
- ) # retrieve text in square brackets at the end of the item's name
39
- if m :
40
- param_values_str = f" { m .group (1 )} "
41
- else :
42
- warnings .warn (
43
- f"Test is parametrized but could not extract parameter values from name: '{ item .name } '"
44
- )
45
- else :
46
- param_values_str = ""
47
-
48
- return param_values_str
49
-
50
-
51
30
def pytest_itemcollected (item ):
52
31
"""
53
32
Custom hook which improves stdout logging from from pytest's default.
54
33
55
34
Instead of just printing the filename and no description of the test
56
- (as would be the default) it prints the docstring as the description
57
- and also adds info about any parameters (if the test is parametrized).
35
+ (as would be the default) it also prints the docstring.
58
36
"""
59
37
if item .obj .__doc__ :
60
- item ._nodeid = "* " + " " .join (item .obj .__doc__ .split ())
61
- item ._nodeid += get_string_with_test_parameter_values (item )
38
+ item ._nodeid = f'{ item ._nodeid } ({ " " .join (item .obj .__doc__ .split ())} )'
62
39
63
40
64
41
class DBConn :
Original file line number Diff line number Diff line change @@ -68,38 +68,15 @@ def exemplar_spatial_unit_param(request):
68
68
yield make_spatial_unit (** request .param )
69
69
70
70
71
- def get_string_with_test_parameter_values (item ):
72
- """
73
- If `item` corresponds to a parametrized pytest test, return a string
74
- containing the parameter values. Otherwise return an empty string.
75
- """
76
- if "parametrize" in item .keywords :
77
- m = re .search (
78
- "(\[.*\])$" , item .name
79
- ) # retrieve text in square brackets at the end of the item's name
80
- if m :
81
- param_values_str = f" { m .group (1 )} "
82
- else :
83
- raise RuntimeError (
84
- f"Test is parametrized but could not extract parameter values from name: '{ item .name } '"
85
- )
86
- else :
87
- param_values_str = ""
88
-
89
- return param_values_str
90
-
91
-
92
71
def pytest_itemcollected (item ):
93
72
"""
94
73
Custom hook which improves stdout logging from from pytest's default.
95
74
96
75
Instead of just printing the filename and no description of the test
97
- (as would be the default) it prints the docstring as the description
98
- and also adds info about any parameters (if the test is parametrized).
76
+ (as would be the default) it also prints the docstring.
99
77
"""
100
78
if item .obj .__doc__ :
101
- item ._nodeid = "* " + " " .join (item .obj .__doc__ .split ())
102
- item ._nodeid += get_string_with_test_parameter_values (item )
79
+ item ._nodeid = f'{ item ._nodeid } ({ " " .join (item .obj .__doc__ .split ())} )'
103
80
104
81
105
82
@pytest .fixture (autouse = True )
You can’t perform that action at this time.
0 commit comments