diff options
author | Joannah Nanjekye <33177550+nanjekyejoannah@users.noreply.github.com> | 2019-02-01 10:05:22 (GMT) |
---|---|---|
committer | Victor Stinner <vstinner@redhat.com> | 2019-02-01 10:05:22 (GMT) |
commit | 80c5dfe74b4402d0a220c9227f262ec6fde1d7fc (patch) | |
tree | 60a2c1af7b30b9b36b4e7a20f7ffe644c6d9a7fb /Lib/test/test_posix.py | |
parent | 05f1b93f5876ac970485ae008dd9ab3e8404f934 (diff) | |
download | cpython-80c5dfe74b4402d0a220c9227f262ec6fde1d7fc.zip cpython-80c5dfe74b4402d0a220c9227f262ec6fde1d7fc.tar.gz cpython-80c5dfe74b4402d0a220c9227f262ec6fde1d7fc.tar.bz2 |
bpo-35537: Add setsid parameter to os.posix_spawn() and os.posix_spawnp() (GH-11608)
Diffstat (limited to 'Lib/test/test_posix.py')
-rw-r--r-- | Lib/test/test_posix.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index 165b837..bc7a2d6 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -1624,6 +1624,22 @@ class _PosixSpawnMixin: os.environ, setsigmask=[signal.NSIG, signal.NSIG+1]) + def test_start_new_session(self): + # For code coverage of calling setsid(). We don't care if we get an + # EPERM error from it depending on the test execution environment, that + # still indicates that it was called. + code = "import os; print(os.getpgid(os.getpid()))" + try: + self.spawn_func(sys.executable, + [sys.executable, "-c", code], + os.environ, setsid=True) + except NotImplementedError as exc: + self.skipTest("setsid is not supported: %s" % exc) + else: + parent_pgid = os.getpgid(os.getpid()) + child_pgid = int(output) + self.assertNotEqual(parent_pgid, child_pgid) + @unittest.skipUnless(hasattr(signal, 'pthread_sigmask'), 'need signal.pthread_sigmask()') def test_setsigdef(self): |