Skip to content

Commit f62b805

Browse files
committed
Fix isolate_tests when run with single files and add usage information
1 parent 7f65f1c commit f62b805

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

scripts/isolate_tests.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,18 @@ def extract_and_write(f, path):
106106
write_cases(f, cases)
107107

108108
if __name__ == '__main__':
109+
if len(sys.argv) == 1:
110+
print("Usage: " + sys.argv[0] + " path-to-file-or-folder-to-extract-code-from [docs]")
111+
exit(1)
112+
109113
path = sys.argv[1]
110114
docs = False
111115
if len(sys.argv) > 2 and sys.argv[2] == 'docs':
112116
docs = True
113117

114118
if isfile(path):
115-
extract_and_write(path, path)
119+
_, tail = split(path)
120+
extract_and_write(tail, path)
116121
else:
117122
for root, subdirs, files in os.walk(path):
118123
if '_build' in subdirs:

0 commit comments

Comments
 (0)