diff options
author | Benjamin Peterson <benjamin@python.org> | 2013-08-24 02:01:48 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2013-08-24 02:01:48 (GMT) |
commit | 3a7dffa4cec84c94685fc9dccbded8ee41904fd5 (patch) | |
tree | 4dd078de4f3cc6fce7c9298689bdc76e27ed8117 /Lib/test | |
parent | 12d5e0f01693686a96eb45af88c2b7f7c6caaac6 (diff) | |
download | cpython-3a7dffa4cec84c94685fc9dccbded8ee41904fd5.zip cpython-3a7dffa4cec84c94685fc9dccbded8ee41904fd5.tar.gz cpython-3a7dffa4cec84c94685fc9dccbded8ee41904fd5.tar.bz2 |
remove support for compiling on systems without getcwd()
Do we need a fallback implementation of getcwd() from 1991 that claims to
support "really old Unix systems"? I don't think so.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_posix.py | 64 |
1 files changed, 31 insertions, 33 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index 4856083..3fd8f11 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -664,41 +664,39 @@ class PosixTester(unittest.TestCase): self.assertEqual(type(v), item_type) def test_getcwd_long_pathnames(self): - if hasattr(posix, 'getcwd'): - dirname = 'getcwd-test-directory-0123456789abcdef-01234567890abcdef' - curdir = os.getcwd() - base_path = os.path.abspath(support.TESTFN) + '.getcwd' + dirname = 'getcwd-test-directory-0123456789abcdef-01234567890abcdef' + curdir = os.getcwd() + base_path = os.path.abspath(support.TESTFN) + '.getcwd' - try: - os.mkdir(base_path) - os.chdir(base_path) - except: -# Just returning nothing instead of the SkipTest exception, -# because the test results in Error in that case. -# Is that ok? -# raise unittest.SkipTest("cannot create directory for testing") - return - - def _create_and_do_getcwd(dirname, current_path_length = 0): - try: - os.mkdir(dirname) - except: - raise unittest.SkipTest("mkdir cannot create directory sufficiently deep for getcwd test") - - os.chdir(dirname) - try: - os.getcwd() - if current_path_length < 1027: - _create_and_do_getcwd(dirname, current_path_length + len(dirname) + 1) - finally: - os.chdir('..') - os.rmdir(dirname) - - _create_and_do_getcwd(dirname) + try: + os.mkdir(base_path) + os.chdir(base_path) + except: + # Just returning nothing instead of the SkipTest exception, because + # the test results in Error in that case. Is that ok? + # raise unittest.SkipTest("cannot create directory for testing") + return - finally: - os.chdir(curdir) - support.rmtree(base_path) + def _create_and_do_getcwd(dirname, current_path_length = 0): + try: + os.mkdir(dirname) + except: + raise unittest.SkipTest("mkdir cannot create directory sufficiently deep for getcwd test") + + os.chdir(dirname) + try: + os.getcwd() + if current_path_length < 1027: + _create_and_do_getcwd(dirname, current_path_length + len(dirname) + 1) + finally: + os.chdir('..') + os.rmdir(dirname) + + _create_and_do_getcwd(dirname) + + finally: + os.chdir(curdir) + support.rmtree(base_path) @unittest.skipUnless(hasattr(posix, 'getgrouplist'), "test needs posix.getgrouplist()") @unittest.skipUnless(hasattr(pwd, 'getpwuid'), "test needs pwd.getpwuid()") |