|
5 | 5 | import sys |
6 | 6 | import timeit |
7 | 7 | from typing import Iterable |
8 | | -import nbconvert |
9 | 8 | import nbformat |
10 | | -from datetime import datetime |
11 | 9 | from nbconvert.preprocessors import ExecutePreprocessor |
12 | 10 | import yaml |
13 | 11 |
|
|
29 | 27 | # following nbs are marked as skipped |
30 | 28 | 'cugraph/algorithms/layout/Force-Atlas2.ipynb', |
31 | 29 | 'cuspatial/binary_predicates.ipynb', |
32 | | - 'cuspatial/cuproj_benchmark.ipynb' |
| 30 | + 'cuspatial/cuproj_benchmark.ipynb', |
| 31 | + # context on these being skipped: https://github.com/rapidsai/cuspatial/pull/1407 |
| 32 | + 'cuspatial/cuspatial_api_examples.ipynb', |
| 33 | + 'cuspatial/nyc_taxi_years_correlation.ipynb' |
33 | 34 | ] |
34 | 35 |
|
35 | 36 |
|
36 | 37 | def get_notebooks(directory: str) -> Iterable[str]: |
37 | | - for root, dirs, files in os.walk(directory): |
| 38 | + for root, _, files in os.walk(directory): |
38 | 39 | for file in files: |
39 | 40 | if ( |
40 | 41 | file.endswith(".ipynb") |
@@ -71,12 +72,12 @@ def test_notebook(notebook_file, executed_nb_file): |
71 | 72 |
|
72 | 73 | # use nbconvert to run the notebook natively |
73 | 74 | ep = ExecutePreprocessor(timeout=600, kernel_name="python3", allow_errors=True) |
| 75 | + task_init = timeit.default_timer() |
74 | 76 | try: |
75 | | - task_init = timeit.default_timer() |
76 | | - nb, nb_resources = ep.preprocess(nb, {"metadata": {"path": ""}}) |
77 | | - execution_time = timeit.default_timer() - task_init |
| 77 | + nb, _ = ep.preprocess(nb, {"metadata": {"path": ""}}) |
78 | 78 | except Exception as e: |
79 | 79 | errors.append(e) |
| 80 | + execution_time = timeit.default_timer() - task_init |
80 | 81 |
|
81 | 82 | with open(executed_nb_file, "w", encoding="utf-8") as f: |
82 | 83 | nbformat.write(nb, f) |
@@ -152,7 +153,7 @@ def test_notebook(notebook_file, executed_nb_file): |
152 | 153 | print(f"Input must be a directory. Got: {ns.input}") |
153 | 154 | sys.exit(1) |
154 | 155 |
|
155 | | - notebooks = sorted(list(get_notebooks(ns.input))) |
| 156 | + notebooks = sorted(get_notebooks(ns.input)) |
156 | 157 | print(f"{len(notebooks)} Notebooks to be tested:") |
157 | 158 | for notebook in notebooks: |
158 | 159 | print(notebook) |
|
0 commit comments