summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinay Sharma <vinay04sharma@icloud.com>2019-09-10 06:48:24 (GMT)
committerPablo Galindo <Pablogsal@gmail.com>2019-09-10 06:48:24 (GMT)
commit2fc1160a80733f4c5c88796319154b3f59e98e4b (patch)
tree8b86537958b624ce68fa742a4b983516872fbc95
parentc59295a1ca304f37ca136dd7efca9e560db27d28 (diff)
downloadcpython-2fc1160a80733f4c5c88796319154b3f59e98e4b.zip
cpython-2fc1160a80733f4c5c88796319154b3f59e98e4b.tar.gz
cpython-2fc1160a80733f4c5c88796319154b3f59e98e4b.tar.bz2
bpo-38018: Fix test for multiprocessing.shared_memory in BSD systems (GH-15821)
-rw-r--r--Lib/test/_test_multiprocessing.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py
index 8269b87..c717d0a 100644
--- a/Lib/test/_test_multiprocessing.py
+++ b/Lib/test/_test_multiprocessing.py
@@ -3732,16 +3732,21 @@ class _TestSharedMemory(BaseTestCase):
with unittest.mock.patch(
'multiprocessing.shared_memory._make_filename') as mock_make_filename:
+ NAME_PREFIX = shared_memory._SHM_NAME_PREFIX
names = ['test01_fn', 'test02_fn']
+ # Prepend NAME_PREFIX which can be '/psm_' or 'wnsm_', necessary
+ # because some POSIX compliant systems require name to start with /
+ names = [NAME_PREFIX + name for name in names]
+
mock_make_filename.side_effect = names
shm1 = shared_memory.SharedMemory(create=True, size=1)
self.addCleanup(shm1.unlink)
- self.assertEqual(shm1.name, names[0])
+ self.assertEqual(shm1._name, names[0])
mock_make_filename.side_effect = names
shm2 = shared_memory.SharedMemory(create=True, size=1)
self.addCleanup(shm2.unlink)
- self.assertEqual(shm2.name, names[1])
+ self.assertEqual(shm2._name, names[1])
if shared_memory._USE_POSIX:
# Posix Shared Memory can only be unlinked once. Here we