Skip to content

Commit 6e8b5ec

Browse files
Apply suggestion from @StanFromIreland
1 parent 4a34337 commit 6e8b5ec

1 file changed

Lines changed: 0 additions & 59 deletions

File tree

Lib/test/_test_multiprocessing.py

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -7146,65 +7146,6 @@ class SemLock(_multiprocessing.SemLock):
71467146
_multiprocessing.sem_unlink(name)
71477147

71487148

7149-
@unittest.skipIf(sys.platform != "linux", "Linux only")
7150-
class ForkInThreads(unittest.TestCase):
7151-
7152-
def test_fork(self):
7153-
code = """
7154-
import os, sys, threading, time
7155-
7156-
t = threading.Thread(target=time.sleep, args=(1,), daemon=True)
7157-
t.start()
7158-
7159-
assert threading.active_count() == 2
7160-
7161-
pid = os.fork()
7162-
if pid < 0:
7163-
print("Fork failed")
7164-
elif pid == 0:
7165-
print("In child")
7166-
sys.exit(0)
7167-
print("In parent")
7168-
"""
7169-
7170-
res = assert_python_ok("-c", code, PYTHONWARNINGS='always')
7171-
self.assertIn(b'In child', res.out)
7172-
self.assertIn(b'In parent', res.out)
7173-
self.assertIn(b'DeprecationWarning', res.err)
7174-
self.assertIn(b'is multi-threaded, use of fork() may lead to deadlocks in the child', res.err)
7175-
7176-
res = assert_python_failure("-c", code, PYTHONWARNINGS='error')
7177-
self.assertIn(b'DeprecationWarning', res.err)
7178-
self.assertIn(b'is multi-threaded, use of fork() may lead to deadlocks in the child', res.err)
7179-
7180-
def test_forkpty(self):
7181-
code = """
7182-
import os, sys, threading, time
7183-
7184-
t = threading.Thread(target=time.sleep, args=(1,), daemon=True)
7185-
t.start()
7186-
7187-
assert threading.active_count() == 2
7188-
7189-
pid, _ = os.forkpty()
7190-
if pid < 0:
7191-
print(f"forkpty failed")
7192-
elif pid == 0:
7193-
print(f"In child")
7194-
sys.exit(0)
7195-
print(f"In parent")
7196-
"""
7197-
7198-
res = assert_python_ok("-c", code, PYTHONWARNINGS='always')
7199-
self.assertIn(b'In parent', res.out)
7200-
self.assertIn(b'DeprecationWarning', res.err)
7201-
self.assertIn(b'is multi-threaded, use of forkpty() may lead to deadlocks in the child', res.err)
7202-
7203-
res = assert_python_failure("-c", code, PYTHONWARNINGS='error')
7204-
self.assertIn(b'DeprecationWarning', res.err)
7205-
self.assertIn(b'is multi-threaded, use of forkpty() may lead to deadlocks in the child', res.err)
7206-
7207-
72087149
@unittest.skipUnless(HAS_SHMEM, "requires multiprocessing.shared_memory")
72097150
class TestSharedMemoryNames(unittest.TestCase):
72107151
def test_that_shared_memory_name_with_colons_has_no_resource_tracker_errors(self):

0 commit comments

Comments
 (0)