Skip to content

Commit

Permalink
Remove custom cadet_root from tests.
Browse files Browse the repository at this point in the history
Add `local` tag to tests that require multiple different CADET installations which is not feasible on the CI and remove those tests from the CI.
  • Loading branch information
ronald-jaepel committed Nov 11, 2024
1 parent 2736031 commit 1303e3e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ jobs:
run: |
pip install .[testing]
mamba install cadet -c conda-forge
pytest tests --rootdir=tests -m "not slow"
pytest tests --rootdir=tests -m "not slow and not local"
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,7 @@ line-length = 88

[tool.pytest.ini_options]
testpaths = ["tests"]
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"local: marks tests as only useful on local installs (deselect with '-m \"not local\"')",
]
5 changes: 2 additions & 3 deletions tests/test_dll.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@

# %% Utility methods

# TODO: Remove once #14 is merged
# cadet_root = Path('/home/jo/code/CADET/install/capi/')
cadet_root = Path(r'C:\Users\ronal\Documents\CADET\out\install\aRELEASE')
# Use this to specify custom cadet_roots if you require it.
cadet_root = None

def setup_model(
cadet_root,
Expand Down
9 changes: 7 additions & 2 deletions tests/test_install_path_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@

from cadet import Cadet

""" These tests require two distinct CADET installations to compare between and should not run in the CI"""


# Full path to cadet.dll or cadet.so, that is different from the system/conda cadet
full_path_dll = Path(r"C:\Users\ronal\Documents\CADET\out\install\aRELEASE\bin\cadet.dll")
full_path_dll = Path("path/to/cadet")

install_path_conda = Cadet.autodetect_cadet()

Expand All @@ -19,7 +22,7 @@ def test_autodetection():
assert sim.cadet_cli_path.parent.parent == install_path_conda
assert sim.cadet_runner.cadet_path.suffix not in [".dll", ".so"]


@pytest.mark.local
def test_install_path():
sim = Cadet(install_path=full_path_dll, use_dll=True)
assert sim.cadet_dll_path == full_path_dll
Expand All @@ -40,6 +43,7 @@ def test_install_path():
assert sim.cadet_runner.cadet_path.suffix in [".dll", ".so"]


@pytest.mark.local
def test_dll_runner_attrs():
cadet = Cadet(full_path_dll.parent.parent)
cadet_runner = cadet._cadet_dll_runner
Expand All @@ -50,6 +54,7 @@ def test_dll_runner_attrs():
assert isinstance(cadet_runner.cadet_path, str | os.PathLike)


@pytest.mark.local
def test_cli_runner_attrs():
cadet = Cadet(full_path_dll.parent.parent)
cadet_runner = cadet._cadet_cli_runner
Expand Down
6 changes: 5 additions & 1 deletion tests/test_meta_class_install_path.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
from pathlib import Path
import pytest

from cadet import Cadet


""" These tests require two distinct CADET installations to compare between and should not run in the CI"""

# Full path to cadet.dll or cadet.so, that is different from the system/conda cadet
full_path_dll = Path(r"C:\Users\ronal\Documents\CADET\out\install\aRELEASE\bin\cadet.dll")
full_path_dll = Path("path/to/cadet")

install_path_conda = Cadet.autodetect_cadet()


@pytest.mark.local
def test_meta_class():
Cadet.cadet_path = full_path_dll
assert Cadet.use_dll
Expand Down

0 comments on commit 1303e3e

Please sign in to comment.