summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_posix.py
diff options
context:
space:
mode:
authorLarry Hastings <larry@hastings.org>2014-02-10 06:05:19 (GMT)
committerLarry Hastings <larry@hastings.org>2014-02-10 06:05:19 (GMT)
commitb082731fbb413a7ff2412a447698fdd65015fd24 (patch)
tree6cb37b4aacee0af28c057079af5545cf92dd1537 /Lib/test/test_posix.py
parentdc62b7e261ab88b4ab967ac2ae307eddbfa0ae09 (diff)
downloadcpython-b082731fbb413a7ff2412a447698fdd65015fd24.zip
cpython-b082731fbb413a7ff2412a447698fdd65015fd24.tar.gz
cpython-b082731fbb413a7ff2412a447698fdd65015fd24.tar.bz2
Issue #20517: Functions in the os module that accept two filenames
now register both filenames in the exception on failure. This required adding new C API functions allowing OSError exceptions to reference two filenames instead of one.
Diffstat (limited to 'Lib/test/test_posix.py')
-rw-r--r--Lib/test/test_posix.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index 4e50cbe..009f29d 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -1121,6 +1121,23 @@ class PosixTester(unittest.TestCase):
# http://lists.freebsd.org/pipermail/freebsd-amd64/2012-January/014332.html
raise unittest.SkipTest("OSError raised!")
+ def test_path_error2(self):
+ """
+ Test functions that call path_error2(), providing two filenames in their exceptions.
+ """
+ for name in ("rename", "replace", "link", "symlink"):
+ function = getattr(os, name, None)
+
+ if function:
+ for dst in ("noodly2", support.TESTFN):
+ try:
+ function('doesnotexistfilename', dst)
+ except OSError as e:
+ self.assertIn("'doesnotexistfilename' -> '{}'".format(dst), str(e))
+ break
+ else:
+ self.fail("No valid path_error2() test for os." + name)
+
class PosixGroupsTester(unittest.TestCase):
def setUp(self):