1
1
import cProfile
2
2
import pstats
3
+ import sys
3
4
import tracemalloc
4
5
import time
5
6
@@ -70,11 +71,29 @@ def test_performance_element_initialisation(mocked_selenium_driver, case, set_el
70
71
print ('peak_mem=' , peak_mem )
71
72
print ('cpu_time=' , cpu_time )
72
73
73
- assert stats .total_tt < 0.45 , f"Execution time too high: { stats .total_tt :.3f} sec"
74
- assert peak_mem < 11 , f"Peak memory usage too high: { peak_mem :.2f} MB"
74
+ expected_peak_mem = 5.3
75
+ expected_init_duration = 0.6
76
+
77
+ if sys .version_info >= (3 , 9 ):
78
+ expected_peak_mem = 5.3
79
+ expected_init_duration = 0.6
80
+ if sys .version_info >= (3 , 10 ):
81
+ expected_peak_mem = 5.3
82
+ expected_init_duration = 0.6
83
+ if sys .version_info >= (3 , 11 ):
84
+ expected_peak_mem = 4.6
85
+ expected_init_duration = 1.0
86
+ if sys .version_info >= (3 , 12 ):
87
+ expected_peak_mem = 4.4
88
+ expected_init_duration = 1.2
89
+
90
+ assert expected_init_duration - 0.5 < stats .total_tt < expected_init_duration ,\
91
+ f"Execution time too high: { stats .total_tt :.3f} sec"
92
+ assert expected_peak_mem - 1 < peak_mem < expected_peak_mem ,\
93
+ f"Peak memory usage too high: { peak_mem :.2f} MB"
75
94
assert len (section .sub_elements ) == section_sub_elements_count , \
76
95
f"Expected { section_sub_elements_count } elements, got { len (section .sub_elements )} "
77
- assert cpu_time < 0.45 , f"CPU execution time too high: { cpu_time :.3f} sec"
96
+ assert cpu_time < expected_init_duration , f"CPU execution time too high: { cpu_time :.3f} sec"
78
97
79
98
80
99
@pytest .fixture (scope = 'module' )
@@ -120,7 +139,28 @@ def test_performance_group_initialisation(mocked_selenium_driver, case, set_grou
120
139
print ('peak_mem=' , peak_mem )
121
140
print ('cpu_time=' , cpu_time )
122
141
123
- assert stats .total_tt < 1.5 , f"Execution time too high: { stats .total_tt :.3f} sec"
124
- assert peak_mem < 4 , f"Peak memory usage too high: { peak_mem :.2f} MB"
125
- assert cpu_time < 1.5 , f"CPU execution time too high: { cpu_time :.3f} sec"
142
+ expected_peak_mem = 3.9
143
+ expected_init_duration = 0.7
144
+
145
+ if sys .version_info >= (3 , 9 ):
146
+ expected_peak_mem = 3.9
147
+ expected_init_duration = 1.0
148
+
149
+ if sys .version_info >= (3 , 10 ):
150
+ expected_peak_mem = 3.9
151
+ expected_init_duration = 0.95
152
+
153
+ if sys .version_info >= (3 , 11 ):
154
+ expected_peak_mem = 3.3
155
+ expected_init_duration = 1.45
156
+
157
+ if sys .version_info >= (3 , 12 ):
158
+ expected_peak_mem = 3.1
159
+ expected_init_duration = 1.75
160
+
161
+ assert expected_init_duration - 0.5 < stats .total_tt < expected_init_duration , \
162
+ f"Execution time too high: { stats .total_tt :.3f} sec"
163
+ assert expected_peak_mem - 1 < peak_mem < expected_peak_mem , \
164
+ f"Peak memory usage too high: { peak_mem :.2f} MB"
165
+ assert cpu_time < expected_init_duration , f"CPU execution time too high: { cpu_time :.3f} sec"
126
166
assert count > 3600 , f"Expected 3600 elements, got { count } "
0 commit comments