diff --git a/.gitignore b/.gitignore index 4755f455..b4fce685 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ /docs/_build/ /dist/ jedi.egg-info/ +record.json diff --git a/sith.py b/sith.py index 524821ce..83e4cea6 100755 --- a/sith.py +++ b/sith.py @@ -61,6 +61,7 @@ class SourceFinder(object): @staticmethod def fetch(file_path): + assert os.path.isdir(file_path), 'Path must be a directory, not a file.' for root, dirnames, filenames in os.walk(file_path): for name in filenames: if name.endswith('.py'): @@ -207,6 +208,9 @@ def main(arguments): int(arguments['']), int(arguments['']) ).run(debugger, print_result=True) else: + if not os.path.isdir(arguments['']): + print('Error: Path must be a directory, not a file.') + sys.exit(1) for _ in range(int(arguments['--maxtries'])): t = TestCase.generate(arguments[''] or '.') t.run(debugger, record)