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