generated from tschm/paper
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* towards testing notebooks * testing notebooks * fmt
- Loading branch information
Showing
5 changed files
with
69 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: "ci" | ||
|
||
on: | ||
- push | ||
|
||
jobs: | ||
test: | ||
# The type of runner that the job will run on | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest, windows-latest, macos-latest ] | ||
python-version: [ '3.10', '3.11', '3.12', '3.13' ] | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
- name: "Build the virtual environment" | ||
uses: cvxgrp/.github/actions/environment@v2.2.3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- uses: cvxgrp/.github/actions/test@v2.2.3 | ||
with: | ||
tests-folder: tests |
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,14 @@ | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
|
||
@pytest.fixture(scope="session", name="resource_dir") | ||
def resource_fixture() -> Path: | ||
"""resource fixture""" | ||
return Path(__file__).parent / "resources" | ||
|
||
|
||
@pytest.fixture(name="root_dir") | ||
def root_fixture(resource_dir: Path) -> Path: | ||
return resource_dir.parent.parent |
Empty file.
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,24 @@ | ||
import subprocess | ||
|
||
|
||
def test_notebooks(root_dir): | ||
# loop over all notebooks | ||
path = root_dir / "notebooks" | ||
|
||
# List all .py files in the directory using glob | ||
py_files = list(path.glob("*.py")) | ||
|
||
# Loop over the files and run them | ||
for py_file in py_files: | ||
print(f"Running {py_file.name}...") | ||
result = subprocess.run( | ||
["python", str(py_file)], capture_output=True, text=True | ||
) | ||
|
||
# Print the result of running the Python file | ||
if result.returncode == 0: | ||
print(f"{py_file.name} ran successfully.") | ||
print(f"Output: {result.stdout}") | ||
else: | ||
print(f"Error running {py_file.name}:") | ||
print(f"stderr: {result.stderr}") |