forked from tox-dev/tox
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_tox_env_runner.py
29 lines (24 loc) · 917 Bytes
/
test_tox_env_runner.py
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
from __future__ import annotations
from pathlib import Path
from tox.pytest import ToxProjectCreator
def test_package_only(
tox_project: ToxProjectCreator,
demo_pkg_inline: Path,
) -> None:
ini = "[testenv]\ncommands = python -c 'print('foo')'"
proj = tox_project(
{"tox.ini": ini, "pyproject.toml": (demo_pkg_inline / "pyproject.toml").read_text()},
base=demo_pkg_inline,
)
execute_calls = proj.patch_execute(lambda r: 0 if "install" in r.run_id else None)
result = proj.run("r", "--sdistonly")
result.assert_success()
expected_calls = [
(".pkg", "_optional_hooks"),
(".pkg", "get_requires_for_build_sdist"),
(".pkg", "build_wheel"),
(".pkg", "build_sdist"),
(".pkg", "_exit"),
]
found_calls = [(i[0][0].conf.name, i[0][3].run_id) for i in execute_calls.call_args_list]
assert found_calls == expected_calls