commit 36618f31c211526053d494ace66df07ef4dc1311 Author: Damian Johnson atagar@torproject.org Date: Tue Jul 31 12:30:31 2018 -0700
Tests fail if gitignore isn't present
Good point from irl that our tests fail if the gitignore file isn't present...
https://trac.torproject.org/projects/tor/ticket/26984
% ./run_tests.py --all Traceback (most recent call last): File "./run_tests.py", line 36, in <module> import test File "/home/atagar/Desktop/stem/test/__init__.py", line 71, in <module> with open(os.path.join(STEM_BASE, '.gitignore')) as ignore_file: IOError: [Errno 2] No such file or directory: '/home/atagar/Desktop/stem/.gitignore' --- test/__init__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/test/__init__.py b/test/__init__.py index 91b26921..db6282f4 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -67,11 +67,13 @@ NEW_CAPABILITIES_SUPPRESSION_TOKENS = set() # File extensions of contents that should be ignored.
IGNORED_FILE_TYPES = [] +GIT_IGNORE_PATH = os.path.join(STEM_BASE, '.gitignore')
-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()) +if os.path.exists(GIT_IGNORE_PATH): + with open(GIT_IGNORE_PATH) as ignore_file: + for line in ignore_file: + if line.startswith('*.'): + IGNORED_FILE_TYPES.append(line[2:].strip())
if os.path.exists(os.path.join(STEM_BASE, '.travis.yml')): IGNORED_FILE_TYPES.append('.travis.yml')