(self)
| 474 | @unittest.skipUnless(has_spawnl, 'os.spawnl not available') |
| 475 | @support.requires_subprocess() |
| 476 | def test_noinherit(self): |
| 477 | # _mkstemp_inner file handles are not inherited by child processes |
| 478 | |
| 479 | if support.verbose: |
| 480 | v="v" |
| 481 | else: |
| 482 | v="q" |
| 483 | |
| 484 | file = self.do_create() |
| 485 | self.assertEqual(os.get_inheritable(file.fd), False) |
| 486 | fd = "%d" % file.fd |
| 487 | |
| 488 | try: |
| 489 | me = __file__ |
| 490 | except NameError: |
| 491 | me = sys.argv[0] |
| 492 | |
| 493 | # We have to exec something, so that FD_CLOEXEC will take |
| 494 | # effect. The core of this test is therefore in |
| 495 | # tf_inherit_check.py, which see. |
| 496 | tester = os.path.join(os.path.dirname(os.path.abspath(me)), |
| 497 | "tf_inherit_check.py") |
| 498 | |
| 499 | # On Windows a spawn* /path/ with embedded spaces shouldn't be quoted, |
| 500 | # but an arg with embedded spaces should be decorated with double |
| 501 | # quotes on each end |
| 502 | if sys.platform == 'win32': |
| 503 | decorated = '"%s"' % sys.executable |
| 504 | tester = '"%s"' % tester |
| 505 | else: |
| 506 | decorated = sys.executable |
| 507 | |
| 508 | retval = os.spawnl(os.P_WAIT, sys.executable, decorated, tester, v, fd) |
| 509 | self.assertFalse(retval < 0, |
| 510 | "child process caught fatal signal %d" % -retval) |
| 511 | self.assertFalse(retval > 0, "child process reports failure %d"%retval) |
| 512 | |
| 513 | @unittest.skipUnless(has_textmode, "text mode not available") |
| 514 | def test_textmode(self): |
nothing calls this directly
no test coverage detected