diff options
author | 2025-10-09 21:57:48 +0100 | |
---|---|---|
committer | 2025-10-09 23:04:41 +0100 | |
commit | d018ee95cf9b0e850e35b54e622af3ca18b24f3e (patch) | |
tree | 25fcdcf2ce0178aaee2078d01d0d8181f4ed6a62 | |
parent | Update numpy version used for integration tests in CI (diff) |
Update nsjail tests to try avoid multiprocessing exception
-rw-r--r-- | tests/test_nsjail.py | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/tests/test_nsjail.py b/tests/test_nsjail.py index 01be592..85bee68 100644 --- a/tests/test_nsjail.py +++ b/tests/test_nsjail.py @@ -108,17 +108,17 @@ class NsJailTests(unittest.TestCase): object = "A" * 40_000_000 time.sleep(0.5) + if __name__ == "__main__": + proc_1 = Process(target=f) + proc_2 = Process(target=f) - proc_1 = Process(target=f) - proc_2 = Process(target=f) + proc_1.start() + proc_2.start() - proc_1.start() - proc_2.start() + proc_1.join() + proc_2.join() - proc_1.join() - proc_2.join() - - print(proc_1.exitcode, proc_2.exitcode) + print(proc_1.exitcode, proc_2.exitcode) """ ) @@ -137,8 +137,9 @@ class NsJailTests(unittest.TestCase): def f(x): return x*x - with Pool(2) as p: - print(p.map(f, [1, 2, 3])) + if __name__ == "__main__": + with Pool(2) as p: + print(p.map(f, [1, 2, 3])) """ ) |