Skip to content

Commit ae6a314

Browse files
Static test fixes
1 parent 8448881 commit ae6a314

File tree

2 files changed

+47
-7
lines changed

2 files changed

+47
-7
lines changed

mops/mixins/internal_mixin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def get_element_info(element: Any, _is_initial_call: bool = True) -> str:
3636
def get_static_with_bases(cls: Any) -> dict:
3737
return get_child_elements_with_names(cls)
3838

39-
@lru_cache(maxsize=64)
39+
@lru_cache(maxsize=16)
4040
def get_static_without_bases(cls: Any) -> dict:
4141
return get_all_attributes_from_object(cls)
4242

tests/static_tests/performance/test_overall_performance.py

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import cProfile
22
import pstats
3+
import sys
34
import tracemalloc
45
import time
56

@@ -70,11 +71,29 @@ def test_performance_element_initialisation(mocked_selenium_driver, case, set_el
7071
print('peak_mem=', peak_mem)
7172
print('cpu_time=', cpu_time)
7273

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"
7594
assert len(section.sub_elements) == section_sub_elements_count, \
7695
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"
7897

7998

8099
@pytest.fixture(scope='module')
@@ -120,7 +139,28 @@ def test_performance_group_initialisation(mocked_selenium_driver, case, set_grou
120139
print('peak_mem=', peak_mem)
121140
print('cpu_time=', cpu_time)
122141

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"
126166
assert count > 3600, f"Expected 3600 elements, got {count}"

0 commit comments

Comments
 (0)