diff options
| author | Damian Johnson <atagar@torproject.org> | 2018-07-31 12:30:31 -0700 |
|---|---|---|
| committer | Damian Johnson <atagar@torproject.org> | 2018-07-31 12:30:31 -0700 |
| commit | 36618f31c211526053d494ace66df07ef4dc1311 (patch) | |
| tree | f93b841555c766af974c92c948456cd474805e9a | |
| parent | 24206c3b7301ed2fbd2a0bd539f951453dea5684 (diff) | |
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'
| -rw-r--r-- | test/__init__.py | 10 |
1 files 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') |
