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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
from __future__ import annotations
import pytest
from tox.pytest import ToxProject, ToxProjectCreator
@pytest.fixture()
def project(tox_project: ToxProjectCreator) -> ToxProject:
ini = """
[tox]
env_list=py32,py31,py
[testenv]
package = wheel
wheel_build_env = pkg
description = with {basepython}
deps = pypy:
[testenv:py]
basepython=py32,py31
[testenv:fix]
description = fix it
[testenv:pkg]
"""
return tox_project({"tox.ini": ini})
def test_list_env(project: ToxProject) -> None:
outcome = project.run("l")
outcome.assert_success()
expected = """
default environments:
py32 -> with py32
py31 -> with py31
py -> with py32 py31
additional environments:
fix -> fix it
pypy -> with pypy
"""
outcome.assert_out_err(expected, "")
def test_list_env_default(project: ToxProject) -> None:
outcome = project.run("l", "-d")
outcome.assert_success()
expected = """
default environments:
py32 -> with py32
py31 -> with py31
py -> with py32 py31
"""
outcome.assert_out_err(expected, "")
def test_list_env_quiet(project: ToxProject) -> None:
outcome = project.run("l", "--no-desc")
outcome.assert_success()
expected = """
py32
py31
py
fix
pypy
"""
outcome.assert_out_err(expected, "")
def test_list_env_quiet_default(project: ToxProject) -> None:
outcome = project.run("l", "--no-desc", "-d")
outcome.assert_success()
expected = """
py32
py31
py
"""
outcome.assert_out_err(expected, "")
def test_list_env_package_env_before_run(tox_project: ToxProjectCreator) -> None:
ini = """
[testenv:pkg]
[testenv:run]
package = wheel
wheel_build_env = pkg
"""
project = tox_project({"tox.ini": ini})
outcome = project.run("l")
outcome.assert_success()
expected = """
default environments:
py -> [no description]
additional environments:
run -> [no description]
"""
outcome.assert_out_err(expected, "")
def test_list_env_package_self(tox_project: ToxProjectCreator) -> None:
ini = """
[tox]
env_list = pkg
[testenv:pkg]
package = wheel
wheel_build_env = pkg
"""
project = tox_project({"tox.ini": ini})
outcome = project.run("l")
outcome.assert_failed()
assert outcome.out.splitlines() == ["ROOT: HandledError| pkg cannot self-package"]
def test_list_envs_help(tox_project: ToxProjectCreator) -> None:
outcome = tox_project({"tox.ini": ""}).run("l", "-h")
outcome.assert_success()
|