summaryrefslogtreecommitdiffstats
path: root/Lib/test/_test_multiprocessing.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/_test_multiprocessing.py')
-rw-r--r--Lib/test/_test_multiprocessing.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py
index d1c7f0b..d7e5332 100644
--- a/Lib/test/_test_multiprocessing.py
+++ b/Lib/test/_test_multiprocessing.py
@@ -3580,16 +3580,11 @@ class TestSemaphoreTracker(unittest.TestCase):
os.write(%d, lock2._semlock.name.encode("ascii") + b"\\n")
time.sleep(10)
'''
- print("\nTestSemaphoreTracker will output warnings a bit like:\n"
- " ... There appear to be 2 leaked semaphores"
- " to clean up at shutdown\n"
- " ... '/mp-03jgqz': [Errno 2] No such file or directory",
- file=sys.stderr)
r, w = os.pipe()
p = subprocess.Popen([sys.executable,
- #'-W', 'ignore:semaphore_tracker',
'-c', cmd % (w, w)],
- pass_fds=[w])
+ pass_fds=[w],
+ stderr=subprocess.PIPE)
os.close(w)
with open(r, 'rb', closefd=True) as f:
name1 = f.readline().rstrip().decode('ascii')
@@ -3602,6 +3597,11 @@ class TestSemaphoreTracker(unittest.TestCase):
_multiprocessing.sem_unlink(name2)
# docs say it should be ENOENT, but OSX seems to give EINVAL
self.assertIn(ctx.exception.errno, (errno.ENOENT, errno.EINVAL))
+ err = p.stderr.read().decode('utf-8')
+ p.stderr.close()
+ expected = 'semaphore_tracker: There appear to be 2 leaked semaphores'
+ self.assertRegex(err, expected)
+ self.assertRegex(err, 'semaphore_tracker: %r: \[Errno' % name1)
#
# Mixins