Skip to content

Commit

Permalink
fix: only deactivate conda inject envs upon workflow tear down (#2503)
Browse files Browse the repository at this point in the history
### Description

<!--Add a description of your PR here-->

### QC
<!-- Make sure that you can tick the boxes below. -->

* [x] The PR contains a test case for the changes or the changes are
already covered by an existing test case.
* [x] The documentation (`docs/`) is updated to reflect the changes or
this is not necessary (e.g. if the change does neither modify the
language nor the behavior or functionalities of Snakemake).
  • Loading branch information
johanneskoester committed Nov 29, 2023
1 parent 5383a4d commit e6dfdd4
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 30 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Expand Up @@ -60,7 +60,7 @@ install_requires =
toposort >=1.10
wrapt
yte >=1.5.1,<2.0
conda-inject >=1.1.1,<2.0
conda-inject >=1.3.1,<2.0

[options.extras_require]
messaging = slacker
Expand Down
2 changes: 1 addition & 1 deletion snakemake/workflow.py
Expand Up @@ -213,7 +213,7 @@ def __post_init__(self):

def tear_down(self):
for conda_env in self.injected_conda_envs:
conda_env.remove()
conda_env.deactivate()
if self._workdir_handler is not None:
self._workdir_handler.change_back()
self._snakemake_tmp_dir.cleanup()
Expand Down
12 changes: 0 additions & 12 deletions tests/linting/version/negative.smk

This file was deleted.

11 changes: 0 additions & 11 deletions tests/linting/version/positive.smk

This file was deleted.

11 changes: 6 additions & 5 deletions tests/test_linting.py
@@ -1,4 +1,4 @@
import os
import os, sys
from pathlib import Path
import subprocess as sp
from itertools import product
Expand All @@ -23,9 +23,9 @@ def test_lint(lint, case):
"snakemake",
"--lint",
"--directory",
lint,
str(lint),
"--snakefile",
lint.joinpath(case).with_suffix(".smk"),
str(lint.joinpath(case).with_suffix(".smk")),
],
stderr=sp.STDOUT,
)
Expand All @@ -35,7 +35,7 @@ def test_lint(lint, case):
if case == "positive":
assert out == "Congratulations, your workflow is in a good condition!"
else:
print(out)
print(out, file=sys.stderr)
assert (
False
), "Negative lint example but linting command exited with status 0."
Expand All @@ -44,8 +44,9 @@ def test_lint(lint, case):
if case == "negative":
assert e.output.decode().strip()
else:
print(e.output.decode().strip(), file=sys.stderr)
raise e

else:
print(out)
print(out, file=sys.stderr)
assert out

0 comments on commit e6dfdd4

Please sign in to comment.