Skip to content

Commit

Permalink
Add unit tests for conda activation script
Browse files Browse the repository at this point in the history
  • Loading branch information
cmrqs committed Dec 3, 2024
1 parent be6c5b2 commit fd40939
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/ert/unit_tests/config/test_queue_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,3 +522,26 @@ def test_default_activate_script_generation(expected, monkeypatch, venv):
monkeypatch.delenv("VIRTUAL_ENV", raising=False)
options = QueueOptions(name="local")
assert options.activate_script == expected


@pytest.mark.parametrize(
"env, expected",
[
("my_env", 'eval "$(conda shell.bash hook)" && conda activate my_env'),
],
)
def test_conda_activate_script_generation(expected, monkeypatch, env):
monkeypatch.setenv("CONDA_ENV", env)
options = QueueOptions(name="local")
assert options.activate_script == expected


@pytest.mark.parametrize(
"env, expected",
[("my_env", "source my_env/bin/activate")],
)
def test_multiple_activate_script_generation(expected, monkeypatch, env):
monkeypatch.setenv("VIRTUAL_ENV", env)
monkeypatch.setenv("CONDA_ENV", env)
options = QueueOptions(name="local")
assert options.activate_script == expected

0 comments on commit fd40939

Please sign in to comment.