From b6b510693b7fbb2e284f373e1841a2a39baba4e2 Mon Sep 17 00:00:00 2001 From: Aaron Meurer Date: Sat, 10 Aug 2013 10:39:19 -0600 Subject: [PATCH] Make sith.py random work with files --- sith.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sith.py b/sith.py index 83e4cea6..42dbf48e 100755 --- a/sith.py +++ b/sith.py @@ -61,7 +61,9 @@ class SourceFinder(object): @staticmethod def fetch(file_path): - assert os.path.isdir(file_path), 'Path must be a directory, not a file.' + if not os.path.isdir(file_path): + yield file_path + return for root, dirnames, filenames in os.walk(file_path): for name in filenames: if name.endswith('.py'): @@ -208,9 +210,6 @@ 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)