diff --git a/src/scripts/test_cli.py b/src/scripts/test_cli.py index eaaf7437e40..db9fffe1408 100755 --- a/src/scripts/test_cli.py +++ b/src/scripts/test_cli.py @@ -1921,13 +1921,13 @@ def main(args=None): start_time = time.time() if threads > 1: - pool = ThreadPool(processes=threads) - results = [] - for test in tests_to_run: - results.append(pool.apply_async(run_test, test)) + with ThreadPool(processes=threads) as pool: + results = [] + for test in tests_to_run: + results.append(pool.apply_async(run_test, test)) - for result in results: - result.get() + for result in results: + result.get() else: for test in tests_to_run: run_test(test[0], test[1]) diff --git a/src/scripts/test_cli_crypt.py b/src/scripts/test_cli_crypt.py index 04104570b55..7c76832e92e 100755 --- a/src/scripts/test_cli_crypt.py +++ b/src/scripts/test_cli_crypt.py @@ -199,13 +199,13 @@ def main(args=None): start_time = time.time() if threads > 1: - pool = ThreadPool(processes=threads) - results = [] - for test in kats: - results.append(pool.apply_async(test_cipher_kat, (cli_binary, test))) + with ThreadPool(processes=threads) as pool: + results = [] + for test in kats: + results.append(pool.apply_async(test_cipher_kat, (cli_binary, test))) - for result in results: - result.get() + for result in results: + result.get() else: for test in kats: test_cipher_kat(cli_binary, test)