diff --git a/conda/meta.yaml b/conda/meta.yaml index 09e0574..756c30e 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -20,8 +20,7 @@ build: noarch: python preserve_egg_dir: True number: 0 - string: py{{ PY_VER }} - script: {{PYTHON}} -m pip install . -vv + script: {{PYTHON}} -m pip install --no-deps --no-build-isolation . -vv requirements: build: @@ -37,7 +36,7 @@ requirements: test: requires: - {% for dep in deps + conda_deps + test_deps %} + {% for dep in test_deps %} - {{ dep }} {% endfor %} imports: diff --git a/pyproject.toml b/pyproject.toml index 06c2176..5c97c20 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,8 +32,8 @@ dynamic = ["readme","version"] dependencies = [ "numpy", "scipy", - "matplotlib-base", "pandas", + "rpy2" ] [project.optional-dependencies] @@ -60,7 +60,7 @@ dependencies = [ "openalea.plantgl", "openalea.caribu", "openalea.astk", - "rpy2" + "matplotlib-base" ] [tool.setuptools.dynamic] readme = {file = ["README.md"]} diff --git a/test/__init__.py b/test/__init__.py new file mode 100644 index 0000000..9ef2f96 --- /dev/null +++ b/test/__init__.py @@ -0,0 +1 @@ +# Needed to make conftest.py visible \ No newline at end of file diff --git a/test/conftest.py b/test/conftest.py new file mode 100644 index 0000000..608a077 --- /dev/null +++ b/test/conftest.py @@ -0,0 +1,14 @@ +import pytest + +try: + # test if R's stats package loads correctly + import rpy2.robjects as ro + ro.r("na.omit") # will error on broken R + R_OK = True +except Exception: + R_OK = False + +pytest_r_skip = pytest.mark.skipif( + not R_OK, + reason="Skipping R/rpy2 tests on this platform due to broken R/rpy2 installation" +) diff --git a/test/test_AdelWheat.py b/test/test_AdelWheat.py index 9b41258..3dd9a81 100644 --- a/test/test_AdelWheat.py +++ b/test/test_AdelWheat.py @@ -1,9 +1,9 @@ from openalea.adel.astk_interface import AdelWheat from openalea.astk.Weather import sample_weather +from .conftest import pytest_r_skip - - +@pytest_r_skip def test_adelwheat(): seq, weather = sample_weather() seq = seq.tz_localize(tz='Europe/Paris') diff --git a/test/test_Adel_Maxwell_plante11.py b/test/test_Adel_Maxwell_plante11.py index 75efa60..ce661be 100644 --- a/test/test_Adel_Maxwell_plante11.py +++ b/test/test_Adel_Maxwell_plante11.py @@ -5,7 +5,10 @@ from openalea.adel.AdelR import devCsv, setAdel, RunAdel, genGeoLeaf, genGeoAxe, \ csvAsDict +from .conftest import pytest_r_skip + +@pytest_r_skip def test_organ_length(): dir = str(pathlib.Path(__file__).parent.resolve() / "data" / "test_Adel_Maxwell_plante11/Maxwell_") sufix = "_plante11.csv" diff --git a/test/test_adelwheat_dynamic.py b/test/test_adelwheat_dynamic.py index 919d34d..d7490d0 100644 --- a/test/test_adelwheat_dynamic.py +++ b/test/test_adelwheat_dynamic.py @@ -1,8 +1,9 @@ """Test use cases of adel/fspm wheat coupling""" - from openalea.adel.adelwheat_dynamic import AdelWheatDyn +from .conftest import pytest_r_skip +@pytest_r_skip def test_add_metamer(): # create a plant with 3 metamers adel = AdelWheatDyn(seed=1234) diff --git a/test/test_astk_interface.py b/test/test_astk_interface.py index cb5806a..a110514 100644 --- a/test/test_astk_interface.py +++ b/test/test_astk_interface.py @@ -1,5 +1,7 @@ from openalea.adel.astk_interface import AdelWheat +from .conftest import pytest_r_skip +pytestmark = pytest_r_skip def test_static(): nplants = 1 diff --git a/test/test_data_samples.py b/test/test_data_samples.py index 1815ac0..5e837f1 100644 --- a/test/test_data_samples.py +++ b/test/test_data_samples.py @@ -1,6 +1,8 @@ from openalea.adel.data_samples import * +from .conftest import pytest_r_skip +@pytest_r_skip def test_leaf_db(): db = leaves_db() sr = srdb() @@ -12,6 +14,7 @@ def test_leaf_db(): assert leaves is not None +@pytest_r_skip def test_devT(): dev = devT() assert dev is not None