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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
from __future__ import annotations
from argparse import Namespace
import pytest
from virtualenv.activation import (
BashActivator,
BatchActivator,
CShellActivator,
FishActivator,
PowerShellActivator,
PythonActivator,
)
from virtualenv.discovery.py_info import PythonInfo
@pytest.mark.parametrize(
"activator_class",
[BatchActivator, PowerShellActivator, PythonActivator, BashActivator, FishActivator],
)
def test_activator_support_windows(mocker, activator_class):
activator = activator_class(Namespace(prompt=None))
interpreter = mocker.Mock(spec=PythonInfo)
interpreter.os = "nt"
assert activator.supports(interpreter)
@pytest.mark.parametrize("activator_class", [CShellActivator])
def test_activator_no_support_windows(mocker, activator_class):
activator = activator_class(Namespace(prompt=None))
interpreter = mocker.Mock(spec=PythonInfo)
interpreter.os = "nt"
assert not activator.supports(interpreter)
@pytest.mark.parametrize(
"activator_class",
[BashActivator, CShellActivator, FishActivator, PowerShellActivator, PythonActivator],
)
def test_activator_support_posix(mocker, activator_class):
activator = activator_class(Namespace(prompt=None))
interpreter = mocker.Mock(spec=PythonInfo)
interpreter.os = "posix"
assert activator.supports(interpreter)
@pytest.mark.parametrize("activator_class", [BatchActivator])
def test_activator_no_support_posix(mocker, activator_class):
activator = activator_class(Namespace(prompt=None))
interpreter = mocker.Mock(spec=PythonInfo)
interpreter.os = "posix"
assert not activator.supports(interpreter)
|