Skip to content

Commit

Permalink
Remove fiona in env diff test for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
rhugonnet committed Aug 2, 2024
1 parent a0faad4 commit d8bd843
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/pip-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
steps:
- uses: actions/checkout@v4

# We initiate the environment empty, and check if a key for this environment doesn't already exist in the cache
# We initiate the environment empty
- name: Initiate empty environment
uses: conda-incubator/setup-miniconda@v3
with:
Expand All @@ -38,15 +38,12 @@ jobs:
activate-environment: xdem-pip
python-version:

# Use pip install
- name: Install project
run: |
mamba install pip
pip install -e .
# This steps allows us to check the "import xdem" with the base environment provided to users, before adding
# development-specific dependencies by differencing the env and dev-env yml files
# Check import works
- name: Check import works with base environment
run: |
# We unset the PROJ_DATA environment variable to make PROJ work on Windows
unset PROJ_DATA
python -c "import xdem"
run: python -c "import xdem"
16 changes: 8 additions & 8 deletions tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ def useless_func() -> int:
def test_diff_environment_yml(self, capsys) -> None: # type: ignore

# Test with synthetic environment
env = {"dependencies": ["python==3.9", "numpy", "fiona"]}
devenv = {"dependencies": ["python==3.9", "numpy", "fiona", "opencv"]}
env = {"dependencies": ["python==3.9", "numpy", "pandas"]}
devenv = {"dependencies": ["python==3.9", "numpy", "pandas", "opencv"]}

# This should print the difference between the two
xdem.misc.diff_environment_yml(env, devenv, input_dict=True, print_dep="conda")
Expand All @@ -134,8 +134,8 @@ def test_diff_environment_yml(self, capsys) -> None: # type: ignore
captured = capsys.readouterr().out
assert captured == "opencv\nNone\n"

env2 = {"dependencies": ["python==3.9", "numpy", "fiona"]}
devenv2 = {"dependencies": ["python==3.9", "numpy", "fiona", "opencv", {"pip": ["geoutils", "-e ./"]}]}
env2 = {"dependencies": ["python==3.9", "numpy", "pandas"]}
devenv2 = {"dependencies": ["python==3.9", "numpy", "pandas", "opencv", {"pip": ["geoutils", "-e ./"]}]}

# The diff function should not account for -e ./ that is the local install for developers
xdem.misc.diff_environment_yml(env2, devenv2, input_dict=True, print_dep="both")
Expand All @@ -155,13 +155,13 @@ def test_diff_environment_yml(self, capsys) -> None: # type: ignore

# When the dependencies are not defined in dev-env but in env, it should raise an error
# For normal dependencies
env3 = {"dependencies": ["python==3.9", "numpy", "fiona", "lol"]}
devenv3 = {"dependencies": ["python==3.9", "numpy", "fiona", "opencv", {"pip": ["geoutils"]}]}
env3 = {"dependencies": ["python==3.9", "numpy", "pandas", "lol"]}
devenv3 = {"dependencies": ["python==3.9", "numpy", "pandas", "opencv", {"pip": ["geoutils"]}]}
with pytest.raises(ValueError, match="The following dependencies are listed in env but not dev-env: lol"):
xdem.misc.diff_environment_yml(env3, devenv3, input_dict=True, print_dep="pip")

# For pip dependencies
env4 = {"dependencies": ["python==3.9", "numpy", "fiona", {"pip": ["lol"]}]}
devenv4 = {"dependencies": ["python==3.9", "numpy", "fiona", "opencv", {"pip": ["geoutils"]}]}
env4 = {"dependencies": ["python==3.9", "numpy", "pandas", {"pip": ["lol"]}]}
devenv4 = {"dependencies": ["python==3.9", "numpy", "pandas", "opencv", {"pip": ["geoutils"]}]}
with pytest.raises(ValueError, match="The following pip dependencies are listed in env but not dev-env: lol"):
xdem.misc.diff_environment_yml(env4, devenv4, input_dict=True, print_dep="pip")

0 comments on commit d8bd843

Please sign in to comment.