cpython: f8ff61f44aca (original) (raw)

--- a/Lib/test/test_stat.py +++ b/Lib/test/test_stat.py @@ -1,14 +1,52 @@ import unittest import os +from test.support import TESTFN, run_unittest, import_fresh_module import stat -from test.support import TESTFN, run_unittest - - -def get_mode(fname=TESTFN):

- class TestFilemode(unittest.TestCase):

+

+

+

+

def setUp(self): try: @@ -20,29 +58,75 @@ class TestFilemode(unittest.TestCase): pass tearDown = setUp

+

+ def test_mode(self): with open(TESTFN, 'w'): pass if os.name == 'posix': os.chmod(TESTFN, 0o700)

+ os.chmod(TESTFN, 0o070)

+ os.chmod(TESTFN, 0o007)

+ os.chmod(TESTFN, 0o444)

def test_directory(self): os.mkdir(TESTFN) os.chmod(TESTFN, 0o700)

@unittest.skipUnless(hasattr(os, 'symlink'), 'os.symlink not available') def test_link(self): @@ -51,12 +135,47 @@ class TestFilemode(unittest.TestCase): except (OSError, NotImplementedError) as err: raise unittest.SkipTest(str(err)) else:

@unittest.skipUnless(hasattr(os, 'mkfifo'), 'os.mkfifo not available') def test_fifo(self): os.mkfifo(TESTFN, 0o700)

+

+

def test_main():