summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/tests/test_dir_util.py
diff options
context:
space:
mode:
authorÉric Araujo <aeric@mtlpy.org>2012-12-09 03:47:03 (GMT)
committerÉric Araujo <aeric@mtlpy.org>2012-12-09 03:47:03 (GMT)
commit24457c9ad375239aca9bd176284d1e4f181e02f4 (patch)
treedebeb009292f1615d17ea061a3ad528b41bfec2d /Lib/distutils/tests/test_dir_util.py
parent62a0d6ea402d18f528629c6e84ed6f46e7c0912a (diff)
parent8b503c0a4e82ba5aadd60215bf493529ce6e1821 (diff)
downloadcpython-24457c9ad375239aca9bd176284d1e4f181e02f4.zip
cpython-24457c9ad375239aca9bd176284d1e4f181e02f4.tar.gz
cpython-24457c9ad375239aca9bd176284d1e4f181e02f4.tar.bz2
Branch merge
Diffstat (limited to 'Lib/distutils/tests/test_dir_util.py')
-rw-r--r--Lib/distutils/tests/test_dir_util.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/Lib/distutils/tests/test_dir_util.py b/Lib/distutils/tests/test_dir_util.py
index ce74589..1589f12 100644
--- a/Lib/distutils/tests/test_dir_util.py
+++ b/Lib/distutils/tests/test_dir_util.py
@@ -76,7 +76,6 @@ class DirUtilTestCase(support.TempdirManager, unittest.TestCase):
remove_tree(self.root_target, verbose=0)
-
def test_copy_tree_verbosity(self):
mkpath(self.target, verbose=0)
@@ -88,11 +87,8 @@ class DirUtilTestCase(support.TempdirManager, unittest.TestCase):
mkpath(self.target, verbose=0)
a_file = os.path.join(self.target, 'ok.txt')
- f = open(a_file, 'w')
- try:
+ with open(a_file, 'w') as f:
f.write('some content')
- finally:
- f.close()
wanted = ['copying %s -> %s' % (a_file, self.target2)]
copy_tree(self.target, self.target2, verbose=1)
@@ -101,6 +97,21 @@ class DirUtilTestCase(support.TempdirManager, unittest.TestCase):
remove_tree(self.root_target, verbose=0)
remove_tree(self.target2, verbose=0)
+ def test_copy_tree_skips_nfs_temp_files(self):
+ mkpath(self.target, verbose=0)
+
+ a_file = os.path.join(self.target, 'ok.txt')
+ nfs_file = os.path.join(self.target, '.nfs123abc')
+ for f in a_file, nfs_file:
+ with open(f, 'w') as fh:
+ fh.write('some content')
+
+ copy_tree(self.target, self.target2)
+ self.assertEqual(os.listdir(self.target2), ['ok.txt'])
+
+ remove_tree(self.root_target, verbose=0)
+ remove_tree(self.target2, verbose=0)
+
def test_ensure_relative(self):
if os.sep == '/':
self.assertEqual(ensure_relative('/home/foo'), 'home/foo')