Skip to content

Commit

Permalink
Use pytest to verify example scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
igortg committed Dec 4, 2023
1 parent db9a505 commit 6da5e10
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 28 deletions.
2 changes: 1 addition & 1 deletion examples/basic_examples/particle_wall_interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,6 @@
ax.set_ylabel("Count [-]")
ax.legend(loc="upper left")

plt.show()
plt.draw()

rocky.close()
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@
ax.set_ylabel("Mass Flow [t/h]")
ax.legend(loc="upper left")

plt.show()
plt.draw()

rocky.close()
26 changes: 0 additions & 26 deletions examples/run_examples.py

This file was deleted.

13 changes: 13 additions & 0 deletions examples/test_examples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from pathlib import Path
import subprocess
import sys

import pytest

EXAMPLES_DIR = Path(__file__).parent / "basic_examples"
EXAMPLE_FILES = EXAMPLES_DIR


@pytest.mark.parametrize("example_path", list(EXAMPLE_FILES.glob("*.py")))
def test_examples(example_path: Path) -> None:
subprocess.check_call([sys.executable, str(example_path.absolute())])

0 comments on commit 6da5e10

Please sign in to comment.