Skip to content

Commit

Permalink
Fix isolate_tests when run with single files and add usage information
Browse files Browse the repository at this point in the history
  • Loading branch information
Marenz committed Jul 1, 2021
1 parent 7f65f1c commit f62b805
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scripts/isolate_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,18 @@ def extract_and_write(f, path):
write_cases(f, cases)

if __name__ == '__main__':
if len(sys.argv) == 1:
print("Usage: " + sys.argv[0] + " path-to-file-or-folder-to-extract-code-from [docs]")
exit(1)

path = sys.argv[1]
docs = False
if len(sys.argv) > 2 and sys.argv[2] == 'docs':
docs = True

if isfile(path):
extract_and_write(path, path)
_, tail = split(path)
extract_and_write(tail, path)
else:
for root, subdirs, files in os.walk(path):
if '_build' in subdirs:
Expand Down

0 comments on commit f62b805

Please sign in to comment.