[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Base files tests ignore on our .gitignore



commit e91a6dad5ba68fea26729e6b166f9d1b801033e8
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Tue Dec 6 10:39:24 2016 -0800

    Base files tests ignore on our .gitignore
    
    There's a few spots we enumerate file types we ignore. Having our tests consult
    the gitignore instead so there's fewer places to keep in sync.
---
 test/integ/installation.py | 2 +-
 test/unit/installation.py  | 2 +-
 test/util.py               | 9 +++++++++
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/test/integ/installation.py b/test/integ/installation.py
index 9e11c4d..43ba3d8 100644
--- a/test/integ/installation.py
+++ b/test/integ/installation.py
@@ -130,7 +130,7 @@ class TestInstallation(unittest.TestCase):
       for filename in filenames:
         file_format = filename.split('.')[-1]
 
-        if file_format not in ('pyc', 'swp', 'swo'):
+        if file_format not in test.util.IGNORED_FILE_TYPES:
           expected.add(os.path.join(root, filename)[len(test.util.STEM_BASE) + 1:])
 
     for root, dirnames, filenames in os.walk(self.site_packages_path):
diff --git a/test/unit/installation.py b/test/unit/installation.py
index 53d9c41..d1c5670 100644
--- a/test/unit/installation.py
+++ b/test/unit/installation.py
@@ -77,7 +77,7 @@ class TestInstallation(unittest.TestCase):
         path = os.path.join(directory, filename)
         file_type = path.split('.')[-1]
 
-        if file_type not in ['.py', '.pyc', '.swp', '.swo', 'orig']:
+        if file_type in (['py'] + test.util.IGNORED_FILE_TYPES):
           continue
         elif path not in data_files:
           self.fail("setup.py doesn't install %s" % path)
diff --git a/test/util.py b/test/util.py
index 7e94ab3..88abce6 100644
--- a/test/util.py
+++ b/test/util.py
@@ -84,6 +84,15 @@ STEM_BASE = os.path.sep.join(__file__.split(os.path.sep)[:-2])
 
 NEW_CAPABILITIES = []
 
+# File extensions of contents that should be ignored.
+
+IGNORED_FILE_TYPES = []
+
+with open(os.path.join(STEM_BASE, '.gitignore')) as ignore_file:
+  for line in ignore_file:
+    if line.startswith('*.'):
+      IGNORED_FILE_TYPES.append(line[2:].strip())
+
 
 def get_unit_tests(module_prefix = None):
   """



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits