diff options
Diffstat (limited to 'Lib/test/support.py')
-rw-r--r-- | Lib/test/support.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/support.py b/Lib/test/support.py index df114a2..b91d732 100644 --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -5,6 +5,7 @@ if __name__ != 'test.support': import contextlib import errno +import functools import socket import sys import os @@ -933,6 +934,16 @@ def threading_cleanup(num_active, num_limbo): count += 1 time.sleep(0.1) +def reap_threads(func): + @functools.wraps(func) + def decorator(*args): + key = threading_setup() + try: + return func(*args) + finally: + threading_cleanup(*key) + return decorator + def reap_children(): """Use this function at the end of test_main() whenever sub-processes are started. This will help ensure that no extra children (zombies) |