[pypy-commit] pypy py3.5: fix the test

arigo pypy.commits at gmail.com
Sat Feb 4 08:32:45 EST 2017


Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5
Changeset: r89918:0d6361cc38d8
Date: 2017-02-04 14:32 +0100
http://bitbucket.org/pypy/pypy/changeset/0d6361cc38d8/

Log:	fix the test

diff --git a/pypy/module/_multiprocessing/test/test_semaphore.py b/pypy/module/_multiprocessing/test/test_semaphore.py
--- a/pypy/module/_multiprocessing/test/test_semaphore.py
+++ b/pypy/module/_multiprocessing/test/test_semaphore.py
@@ -102,16 +102,20 @@
         assert res == False
 
     def test_semaphore_rebuild(self):
-        from _multiprocessing import SemLock
+        from _multiprocessing import SemLock, sem_unlink
         kind = self.SEMAPHORE
         value = 1
         maxvalue = 1
-        sem = SemLock(kind, value, maxvalue, "4", unlink=True)
-
-        sem2 = SemLock._rebuild(sem.handle, kind, value, "92")
-        assert sem.handle != sem2.handle
-        sem2 = SemLock._rebuild(sem.handle, kind, value, None)
-        assert sem.handle == sem2.handle
+        sem = SemLock(kind, value, maxvalue, "4.2", unlink=False)
+        try:
+            sem2 = SemLock._rebuild(-1, kind, value, "4.2")
+            #assert sem.handle != sem2.handle---even though they come
+            # from different calls to sem_open(), on Linux at least,
+            # they are the same pointer
+            sem2 = SemLock._rebuild(sem.handle, kind, value, None)
+            assert sem.handle == sem2.handle
+        finally:
+            sem_unlink("4.2")
 
     def test_semaphore_contextmanager(self):
         from _multiprocessing import SemLock


More information about the pypy-commit mailing list