summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_filecmp.py
diff options
context:
space:
mode:
authorEli Bendersky <eliben@gmail.com>2013-01-12 14:13:32 (GMT)
committerEli Bendersky <eliben@gmail.com>2013-01-12 14:13:32 (GMT)
commiteb2884a87575f49d797d504872b2efd1f132a771 (patch)
treedc23e9de311ff042e88af1b6d5c03750e9e665df /Lib/test/test_filecmp.py
parent60a0c710311b29539f8c8a6404a51b21f44b1e43 (diff)
downloadcpython-eb2884a87575f49d797d504872b2efd1f132a771.zip
cpython-eb2884a87575f49d797d504872b2efd1f132a771.tar.gz
cpython-eb2884a87575f49d797d504872b2efd1f132a771.tar.bz2
Close #15442: Expand the list of default directories ignored by filecmp.dircmp and expose it as a module attribute
Diffstat (limited to 'Lib/test/test_filecmp.py')
-rw-r--r--Lib/test/test_filecmp.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/Lib/test/test_filecmp.py b/Lib/test/test_filecmp.py
index 0959979..f760147 100644
--- a/Lib/test/test_filecmp.py
+++ b/Lib/test/test_filecmp.py
@@ -1,4 +1,3 @@
-
import os, filecmp, shutil, tempfile
import unittest
from test import support
@@ -46,9 +45,14 @@ class DirCompareTestCase(unittest.TestCase):
self.dir = os.path.join(tmpdir, 'dir')
self.dir_same = os.path.join(tmpdir, 'dir-same')
self.dir_diff = os.path.join(tmpdir, 'dir-diff')
+
+ # Another dir is created under dir_same, but it has a name from the
+ # ignored list so it should not affect testing results.
+ self.dir_ignored = os.path.join(self.dir_same, '.hg')
+
self.caseinsensitive = os.path.normcase('A') == os.path.normcase('a')
data = 'Contents of file go here.\n'
- for dir in [self.dir, self.dir_same, self.dir_diff]:
+ for dir in (self.dir, self.dir_same, self.dir_diff, self.dir_ignored):
shutil.rmtree(dir, True)
os.mkdir(dir)
if self.caseinsensitive and dir is self.dir_same:
@@ -64,9 +68,11 @@ class DirCompareTestCase(unittest.TestCase):
output.close()
def tearDown(self):
- shutil.rmtree(self.dir)
- shutil.rmtree(self.dir_same)
- shutil.rmtree(self.dir_diff)
+ for dir in (self.dir, self.dir_same, self.dir_diff):
+ shutil.rmtree(dir)
+
+ def test_default_ignores(self):
+ self.assertIn('.hg', filecmp.DEFAULT_IGNORES)
def test_cmpfiles(self):
self.assertTrue(filecmp.cmpfiles(self.dir, self.dir, ['file']) ==