|
9 | 9 | import tracemalloc |
10 | 10 | from Python.Test import MethodTest |
11 | 11 |
|
| 12 | +MEM_LEAK_THRESHOLD = 0.3 |
| 13 | + |
12 | 14 | @pytest.fixture(scope="function") |
13 | 15 | def memory_usage_tracking(): |
14 | 16 | was_tracing = tracemalloc.is_tracing() |
@@ -985,7 +987,7 @@ def test_getting_generic_method_binding_does_not_leak_memory(memory_usage_tracki |
985 | 987 |
|
986 | 988 | # Allow 90% threshold - this shows the original issue is fixed, which leaks the full allocated bytes per iteration |
987 | 989 | # Increased from 50% to ensure that it works on Windows with Python >3.13 |
988 | | - failThresholdBytesLeakedPerIteration = bytesAllocatedPerIteration * 0.1 |
| 990 | + failThresholdBytesLeakedPerIteration = bytesAllocatedPerIteration * MEM_LEAK_THRESHOLD |
989 | 991 |
|
990 | 992 | assert bytesLeakedPerIteration < failThresholdBytesLeakedPerIteration |
991 | 993 |
|
@@ -1026,7 +1028,7 @@ def test_getting_overloaded_method_binding_does_not_leak_memory(memory_usage_tra |
1026 | 1028 | bytesLeakedPerIteration = processBytesDelta / iterations |
1027 | 1029 |
|
1028 | 1030 | # Allow 90% threshold - this shows the original issue is fixed, which leaks the full allocated bytes per iteration |
1029 | | - failThresholdBytesLeakedPerIteration = bytesAllocatedPerIteration * 0.1 |
| 1031 | + failThresholdBytesLeakedPerIteration = bytesAllocatedPerIteration * MEM_LEAK_THRESHOLD |
1030 | 1032 |
|
1031 | 1033 | assert bytesLeakedPerIteration < failThresholdBytesLeakedPerIteration |
1032 | 1034 |
|
@@ -1069,7 +1071,7 @@ def test_getting_method_overloads_binding_does_not_leak_memory(memory_usage_trac |
1069 | 1071 | bytesLeakedPerIteration = processBytesDelta / iterations |
1070 | 1072 |
|
1071 | 1073 | # Allow 90% threshold - this shows the original issue is fixed, which leaks the full allocated bytes per iteration |
1072 | | - failThresholdBytesLeakedPerIteration = bytesAllocatedPerIteration * 0.1 |
| 1074 | + failThresholdBytesLeakedPerIteration = bytesAllocatedPerIteration * MEM_LEAK_THRESHOLD |
1073 | 1075 |
|
1074 | 1076 | assert bytesLeakedPerIteration < failThresholdBytesLeakedPerIteration |
1075 | 1077 |
|
|
0 commit comments