Skip to content

Commit b82c995

Browse files
committed
Fix bug when notebook doesn't have a dir part.
1 parent 3f38413 commit b82c995

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

run_notebook.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def convert_notebook(notebook):
3131

3232

3333
def run_notebook(notebook):
34-
with cd(os.path.dirname(notebook)):
34+
with cd(os.path.dirname(notebook) or '.'):
3535
script = convert_notebook(os.path.basename(notebook))
3636
_, script_file = tempfile.mkstemp(prefix='.', suffix='.py', dir='.')
3737
with open(script_file, 'wb') as fp:
@@ -117,7 +117,7 @@ def main():
117117
import argparse
118118
parser = argparse.ArgumentParser(
119119
description='Run Jupyter notebooks.')
120-
parser.add_argument('notebook', type=str, nargs='*',
120+
parser.add_argument('notebook', type=str, nargs='*', default=[],
121121
help='Notebook to test.')
122122
parser.add_argument('--skip', type=str, action='append', default=[],
123123
help='Notebooks to skip.')
@@ -129,6 +129,7 @@ def main():
129129
args = parser.parse_args()
130130

131131
notebooks = read_notebooks_from_file(args.file) + args.notebook
132+
132133
skip = match_by_pattern(notebooks, args.skip)
133134

134135
summary = []

0 commit comments

Comments
 (0)