langdonholmes commited on
Commit
a5de4d1
1 Parent(s): ceb9976

try except block in test

Browse files
Files changed (1) hide show
  1. piilo/test_main.py +10 -6
piilo/test_main.py CHANGED
@@ -11,12 +11,16 @@ def test_anonymizer(texts):
11
  return [piilo.anonymize(text) for text in texts]
12
 
13
  if __name__ == "__main__":
14
- from pathlib import Path
15
- import sys
16
- # Add piilo to sys.path so that we can import from piilo
17
- sys.path.insert(0, str(Path(__file__).parent.parent))
18
-
19
- import piilo
 
 
 
 
20
 
21
  texts = [
22
  'test string without identifiers',
 
11
  return [piilo.anonymize(text) for text in texts]
12
 
13
  if __name__ == "__main__":
14
+ try:
15
+ import piilo
16
+ except ImportError:
17
+ logger.info('Piilo not found in site-packages.')
18
+ logger.info('Temporarily adding parent directory to path...')
19
+ from pathlib import Path
20
+ import sys
21
+ # Add piilo to sys.path so that we can import from piilo
22
+ sys.path.insert(0, str(Path(__file__).parent.parent))
23
+ import piilo
24
 
25
  texts = [
26
  'test string without identifiers',