summaryrefslogtreecommitdiffstats
path: root/tests/languages/conda_test.py
blob: 6faa78f219ffef5cd2ae520915cdb9f3d788af7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import pytest

from pre_commit import envcontext
from pre_commit.languages.conda import _conda_exe


@pytest.mark.parametrize(
    ('ctx', 'expected'),
    (
        pytest.param(
            (
                ('PRE_COMMIT_USE_MICROMAMBA', envcontext.UNSET),
                ('PRE_COMMIT_USE_MAMBA', envcontext.UNSET),
            ),
            'conda',
            id='default',
        ),
        pytest.param(
            (
                ('PRE_COMMIT_USE_MICROMAMBA', '1'),
                ('PRE_COMMIT_USE_MAMBA', ''),
            ),
            'micromamba',
            id='default',
        ),
        pytest.param(
            (
                ('PRE_COMMIT_USE_MICROMAMBA', ''),
                ('PRE_COMMIT_USE_MAMBA', '1'),
            ),
            'mamba',
            id='default',
        ),
    ),
)
def test_conda_exe(ctx, expected):
    with envcontext.envcontext(ctx):
        assert _conda_exe() == expected