Skip to content

Commit 4855944

Browse files
Move to a specific cotainr-conda location rather than a generic conda-location (#66)
* Change prefix from /opt/conda to /opt/cotainr/conda * Linting fixes * Change prefix of tests * Fix comments
1 parent ec2ff39 commit 4855944

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

cotainr/pack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def __init__(
7676
self,
7777
*,
7878
sandbox,
79-
prefix="/opt/conda",
79+
prefix="/opt/cotainr/conda",
8080
license_accepted=False,
8181
log_settings=None,
8282
):

cotainr/tests/pack/test_conda_install.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def test_attributes(
3838
with SingularitySandbox(base_image="my_base_image_6021") as sandbox:
3939
conda_install = CondaInstall(sandbox=sandbox, license_accepted=True)
4040
assert conda_install.sandbox == sandbox
41-
assert conda_install.prefix == "/opt/conda"
41+
assert conda_install.prefix == "/opt/cotainr/conda"
4242
assert conda_install.license_accepted
4343
assert conda_install.log_dispatcher is None
4444
assert conda_install._verbosity == 0
@@ -124,6 +124,7 @@ def test_setup_log_dispatcher(
124124
class TestAddEnvironment:
125125
def test_env_creation(self, tmp_path, data_cached_ubuntu_sif):
126126
conda_env_path = tmp_path / "conda_env.yml"
127+
prefix = "/opt/cotainr/conda"
127128
conda_env_path.write_text(
128129
"channels:\n - conda-forge\ndependencies:\n - python"
129130
)
@@ -134,15 +135,16 @@ def test_env_creation(self, tmp_path, data_cached_ubuntu_sif):
134135
process = sandbox.run_command_in_container(cmd="conda info -e")
135136
assert re.search(
136137
# We expect to find a line in the list of environments similar to:
137-
# some_env_name_6021 /opt/conda/envs/some_env_name_6021
138-
rf"^{conda_env_name}(\s)+/opt/conda/envs/{conda_env_name}$",
138+
# some_env_name_6021 /opt/cotainr/conda/envs/some_env_name_6021
139+
rf"^{conda_env_name}(\s)+{prefix}/envs/{conda_env_name}$",
139140
process.stdout,
140141
flags=re.MULTILINE,
141142
)
142143

143144
def test_other_conda_channels_than_condaforge(
144145
self, tmp_path, data_cached_ubuntu_sif
145146
):
147+
prefix = "/opt/cotainr/conda"
146148
conda_env_path = tmp_path / "conda_env.yml"
147149
conda_env_path.write_text(
148150
"channels:\n - bioconda\ndependencies:\n - samtools"
@@ -154,8 +156,8 @@ def test_other_conda_channels_than_condaforge(
154156
process = sandbox.run_command_in_container(cmd="conda info -e")
155157
assert re.search(
156158
# We expect to find a line in the list of environments similar to:
157-
# some_env_name_6021 /opt/conda/envs/some_env_name_6021
158-
rf"^{conda_env_name}(\s)+/opt/conda/envs/{conda_env_name}$",
159+
# some_env_name_6021 /opt/cotainr/conda/envs/some_env_name_6021
160+
rf"^{conda_env_name}(\s)+{prefix}/envs/{conda_env_name}$",
159161
process.stdout,
160162
flags=re.MULTILINE,
161163
)
@@ -183,7 +185,8 @@ def test_all_unneeded_removed(self, data_cached_ubuntu_sif):
183185
class Test_BootstrapConda:
184186
def test_correct_conda_installer_bootstrap(self, data_cached_ubuntu_sif):
185187
with SingularitySandbox(base_image=data_cached_ubuntu_sif) as sandbox:
186-
conda_install_dir = sandbox.sandbox_dir / "opt/conda"
188+
prefix = "opt/cotainr/conda"
189+
conda_install_dir = sandbox.sandbox_dir / prefix
187190
assert not conda_install_dir.exists()
188191
CondaInstall(sandbox=sandbox, license_accepted=True)
189192

@@ -192,7 +195,7 @@ def test_correct_conda_installer_bootstrap(self, data_cached_ubuntu_sif):
192195

193196
# Check that we are using our installed conda
194197
process = sandbox.run_command_in_container(cmd="conda info --base")
195-
assert process.stdout.strip() == "/opt/conda"
198+
assert process.stdout.strip() == "/" + prefix
196199

197200
# Check that the installed conda is up-to-date
198201
process = sandbox.run_command_in_container(

0 commit comments

Comments
 (0)