(self)
| 2328 | @unittest.skipIf(mswindows or not hasattr(os, 'umask'), |
| 2329 | 'POSIX umask() is not available.') |
| 2330 | def test_umask(self): |
| 2331 | tmpdir = None |
| 2332 | try: |
| 2333 | tmpdir = tempfile.mkdtemp() |
| 2334 | name = os.path.join(tmpdir, "beans") |
| 2335 | # We set an unusual umask in the child so as a unique mode |
| 2336 | # for us to test the child's touched file for. |
| 2337 | subprocess.check_call( |
| 2338 | [sys.executable, "-c", f"open({name!r}, 'w').close()"], |
| 2339 | umask=0o053) |
| 2340 | # Ignore execute permissions entirely in our test, |
| 2341 | # filesystems could be mounted to ignore or force that. |
| 2342 | st_mode = os.stat(name).st_mode & 0o666 |
| 2343 | expected_mode = 0o624 |
| 2344 | self.assertEqual(expected_mode, st_mode, |
| 2345 | msg=f'{oct(expected_mode)} != {oct(st_mode)}') |
| 2346 | finally: |
| 2347 | if tmpdir is not None: |
| 2348 | shutil.rmtree(tmpdir) |
| 2349 | |
| 2350 | def test_run_abort(self): |
| 2351 | # returncode handles signal termination |
nothing calls this directly
no test coverage detected