-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: drop py3.8 and torch1.12; update deps. fix slow tests. (#1233)
* add tutorials test; fix slow tests, typing. * build: drop python3.8 and torch 1.12, update deps. - add movie writer to dev deps - downgrade scipy to enable py3.9 support
- Loading branch information
Showing
7 changed files
with
63 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ jobs: | |
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.8' | ||
python-version: '3.9' | ||
- uses: pre-commit/[email protected] | ||
with: | ||
extra_args: --all-files --show-diff-on-failure | ||
|
@@ -40,14 +40,14 @@ jobs: | |
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.8' | ||
python-version: '3.9' | ||
|
||
- name: Cache dependency | ||
id: cache-dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/pip | ||
key: ubuntu-latest-pip-3.8 | ||
key: ubuntu-latest-pip-3.9 | ||
restore-keys: | | ||
ubuntu-latest-pip- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import os | ||
|
||
import nbformat | ||
import pytest | ||
from nbclient.exceptions import CellExecutionError | ||
from nbconvert.preprocessors import ExecutePreprocessor | ||
|
||
|
||
def list_notebooks(directory: str) -> list: | ||
"""Return sorted list of all notebooks in a directory.""" | ||
notebooks = [ | ||
os.path.join(directory, f) | ||
for f in os.listdir(directory) | ||
if f.endswith("distributions.ipynb") | ||
] | ||
return sorted(notebooks) | ||
|
||
|
||
@pytest.mark.slow | ||
@pytest.mark.parametrize("notebook_path", list_notebooks("tutorials/")) | ||
def test_tutorials(notebook_path): | ||
"""Test that all notebooks in the tutorials directory can be executed.""" | ||
with open(notebook_path) as f: | ||
nb = nbformat.read(f, as_version=4) | ||
ep = ExecutePreprocessor(timeout=600, kernel_name='python3') | ||
print(f"Executing notebook {notebook_path}") | ||
try: | ||
ep.preprocess(nb, {'metadata': {'path': os.path.dirname(notebook_path)}}) | ||
except CellExecutionError as e: | ||
# Conditional_distributions tutorial requires movie writer that is failing | ||
# in GitHub CI. | ||
if "Requested MovieWriter" in str(e): | ||
print("Skipping error in movie writer.") | ||
else: | ||
raise CellExecutionError from e | ||
except Exception as e: | ||
raise AssertionError( | ||
f"Error executing the notebook {notebook_path}: {e}" | ||
) from e |