summaryrefslogtreecommitdiff
path: root/Lib/test/test_genericpath.py
diff options
context:
space:
mode:
authorBrian Curtin <brian@python.org>2012-12-26 07:36:16 -0600
committerBrian Curtin <brian@python.org>2012-12-26 07:36:16 -0600
commite701ec5d3fbe9889ef17ff15c6eff325e8705b86 (patch)
treec591dc48443b14e17c4e380d9cd59c8a7e5c02a9 /Lib/test/test_genericpath.py
parent501c8f915fcebc91a7d3fe766e1c05ca6643e608 (diff)
downloadcpython-git-e701ec5d3fbe9889ef17ff15c6eff325e8705b86.tar.gz
Add tests for Issue #10646.
This issue is now fixed due to changes in Issue #11939, so I've refactored the tests to cover the hard link case. There are no code changes here.
Diffstat (limited to 'Lib/test/test_genericpath.py')
-rw-r--r--Lib/test/test_genericpath.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/Lib/test/test_genericpath.py b/Lib/test/test_genericpath.py
index 36d58e3b52..060102df73 100644
--- a/Lib/test/test_genericpath.py
+++ b/Lib/test/test_genericpath.py
@@ -205,13 +205,19 @@ class GenericTest(unittest.TestCase):
os.remove(test_fn)
@support.skip_unless_symlink
- def test_samefile_on_links(self):
+ def test_samefile_on_symlink(self):
+ self._test_samefile_on_link_func(os.symlink)
+
+ def test_samefile_on_link(self):
+ self._test_samefile_on_link_func(os.link)
+
+ def _test_samefile_on_link_func(self, func):
try:
test_fn1 = support.TESTFN + "1"
test_fn2 = support.TESTFN + "2"
self._create_file(test_fn1)
- os.symlink(test_fn1, test_fn2)
+ func(test_fn1, test_fn2)
self.assertTrue(self.pathmodule.samefile(test_fn1, test_fn2))
os.remove(test_fn2)
@@ -232,13 +238,19 @@ class GenericTest(unittest.TestCase):
os.remove(test_fn)
@support.skip_unless_symlink
- def test_samestat_on_links(self):
+ def test_samestat_on_symlink(self):
+ self._test_samestat_on_link_func(os.symlink)
+
+ def test_samestat_on_link(self):
+ self._test_samestat_on_link_func(os.link)
+
+ def _test_samestat_on_link_func(self, func):
try:
test_fn1 = support.TESTFN + "1"
test_fn2 = support.TESTFN + "2"
self._create_file(test_fn1)
test_fns = (test_fn1, test_fn2)
- os.symlink(*test_fns)
+ func(*test_fns)
stats = map(os.stat, test_fns)
self.assertTrue(self.pathmodule.samestat(*stats))
os.remove(test_fn2)