cpython: 32c5b9aeee82 (original) (raw)

--- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -4,6 +4,7 @@ import os import errno +import getpass import unittest import warnings import sys @@ -45,12 +46,30 @@ try: except ImportError: _winapi = None try:

+except ImportError:

+try:

+except ImportError:

+try: from _testcapi import INT_MAX, PY_SSIZE_T_MAX except ImportError: INT_MAX = PY_SSIZE_T_MAX = sys.maxsize from test.script_helper import assert_python_ok +root_in_posix = False +if hasattr(os, 'geteuid'):

+ with warnings.catch_warnings(): warnings.simplefilter("ignore", DeprecationWarning) os.stat_float_times(True) @@ -962,17 +981,6 @@ class MakedirTests(unittest.TestCase): os.makedirs(path, mode=mode, exist_ok=True) os.umask(old_mask)

- def test_exist_ok_s_isgid_directory(self): path = os.path.join(support.TESTFN, 'dir1') S_ISGID = stat.S_ISGID @@ -1023,6 +1031,58 @@ class MakedirTests(unittest.TestCase): os.removedirs(path) +@unittest.skipUnless(hasattr(os, 'chown'), "Test needs chown") +class ChownFileTests(unittest.TestCase): +

+

+

+

+

+

+ + class RemoveDirsTests(unittest.TestCase): def setUp(self): os.makedirs(support.TESTFN) @@ -2083,11 +2143,13 @@ class TestSendfile(unittest.TestCase): @classmethod def setUpClass(cls):

@classmethod def tearDownClass(cls):

def setUp(self): @@ -2636,44 +2698,5 @@ class ExportsTests(unittest.TestCase): self.assertIn('walk', os.all) -@support.reap_threads -def test_main():

- if name == "main":