Skip to content

Commit 8c499bd

Browse files
committed
added conditional cleanup
1 parent 45f0476 commit 8c499bd

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

sdks/python/conftest.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,22 +155,23 @@ def ensure_clean_state(request):
155155

156156
enable_cleanup = _should_enable_test_cleanup(request.config)
157157

158-
gc.collect()
158+
if enable_cleanup:
159+
gc.collect()
159160

160161
thread_count = threading.active_count()
161162
if thread_count > 50:
162163
print(f"Warning: {thread_count} active threads detected before test")
163164
if enable_cleanup:
164165
time.sleep(0.5)
165-
gc.collect()
166+
gc.collect()
166167

167168
yield
168169

169170
try:
170-
gc.collect()
171171
if enable_cleanup:
172+
gc.collect()
172173
time.sleep(0.1)
173-
gc.collect()
174+
gc.collect()
174175
except Exception as e:
175176
print(f"Warning: Cleanup error: {e}")
176177

0 commit comments

Comments
 (0)