summaryrefslogtreecommitdiffstats
path: root/tests/languages/conda_test.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-01-30 16:53:19 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-01-30 16:53:19 +0000
commit02d5100afa71d1343de4066b812cd4cdc774d812 (patch)
tree6bccae957398fab29aaa226fb0bd65f0c258a36a /tests/languages/conda_test.py
parentAdding upstream version 2.21.0. (diff)
downloadpre-commit-02d5100afa71d1343de4066b812cd4cdc774d812.tar.xz
pre-commit-02d5100afa71d1343de4066b812cd4cdc774d812.zip
Adding upstream version 3.0.2.upstream/3.0.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/languages/conda_test.py')
-rw-r--r--tests/languages/conda_test.py36
1 files changed, 34 insertions, 2 deletions
diff --git a/tests/languages/conda_test.py b/tests/languages/conda_test.py
index 5023b2a..83aaebe 100644
--- a/tests/languages/conda_test.py
+++ b/tests/languages/conda_test.py
@@ -1,9 +1,13 @@
from __future__ import annotations
+import os.path
+
import pytest
from pre_commit import envcontext
-from pre_commit.languages.conda import _conda_exe
+from pre_commit.languages import conda
+from pre_commit.store import _make_local_repo
+from testing.language_helpers import run_language
@pytest.mark.parametrize(
@@ -37,4 +41,32 @@ from pre_commit.languages.conda import _conda_exe
)
def test_conda_exe(ctx, expected):
with envcontext.envcontext(ctx):
- assert _conda_exe() == expected
+ assert conda._conda_exe() == expected
+
+
+def test_conda_language(tmp_path):
+ environment_yml = '''\
+channels: [conda-forge, defaults]
+dependencies: [python, pip]
+'''
+ tmp_path.joinpath('environment.yml').write_text(environment_yml)
+
+ ret, out = run_language(
+ tmp_path,
+ conda,
+ 'python -c "import sys; print(sys.prefix)"',
+ )
+ assert ret == 0
+ assert os.path.basename(out.strip()) == b'conda-default'
+
+
+def test_conda_additional_deps(tmp_path):
+ _make_local_repo(tmp_path)
+
+ ret = run_language(
+ tmp_path,
+ conda,
+ 'python -c "import botocore; print(1)"',
+ deps=('botocore',),
+ )
+ assert ret == (0, b'1\n')