Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
goanpeca committed Nov 30, 2022
1 parent 5f1d0cb commit 28459d2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
10 changes: 6 additions & 4 deletions constructor-manager-cli/src/constructor_manager_cli/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,9 @@ def lock(

return self._queue_args(args, bin="conda-lock", block=block)

def create(self, prefix: str, *, pkg_list: Sequence[str] = ()) -> job_id:
def create(
self, prefix: str, *, pkg_list: Sequence[str] = (), block: bool = False
) -> job_id:
"""Create a new conda environment with `pkg_list` in `prefix`.
Parameters
Expand All @@ -328,9 +330,9 @@ def create(self, prefix: str, *, pkg_list: Sequence[str] = ()) -> job_id:
job_id : int
ID that can be used to cancel the process.
"""
return self._queue_args(self._get_create_args(pkg_list, prefix))
return self._queue_args(self._get_create_args(pkg_list, prefix), block=block)

def remove(self, prefix) -> job_id:
def remove(self, prefix: str, block: bool = False) -> job_id:
"""Remove a conda environment in `prefix`.
Parameters
Expand All @@ -343,7 +345,7 @@ def remove(self, prefix) -> job_id:
job_id : int
ID that can be used to cancel the process.
"""
return self._queue_args(self._get_remove_args(prefix))
return self._queue_args(self._get_remove_args(prefix), block=block)

def install(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ def test_conda_installer_create_remove(use_mamba):

installer = CondaInstaller(use_mamba=use_mamba)
# Create
job_id = installer.create(prefix=prefix)
_ = installer.create(prefix=prefix, block=True)
assert prefix.exists()
assert installer._exit_codes[job_id] == 0
# assert installer._exit_codes[job_id] == 0

# Remove
job_id = installer.remove(prefix=prefix)
_ = installer.remove(prefix=prefix, block=True)
assert not prefix.exists()
assert installer._exit_codes[job_id] == 0
# assert installer._exit_codes[job_id] == 0


@pytest.mark.parametrize("use_mamba", [True, False])
Expand Down

0 comments on commit 28459d2

Please sign in to comment.