Skip to content

Commit

Permalink
Show host python under core section as constant
Browse files Browse the repository at this point in the history
Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
  • Loading branch information
gaborbernat committed Dec 8, 2022
1 parent 267d327 commit 159e6b5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/changelog/2630.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
The core tox configuration now contains ``host_python`` key showing the host python executable path -
by :user:`gaborbernat`.
1 change: 1 addition & 0 deletions src/tox/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def main(args: Sequence[str]) -> int:
result = provision(state)
if result is not False:
return result
state.conf.core.add_constant("host_python", "the host python executable path", sys.executable)
handler = state._options.cmd_handlers[state.conf.options.command]
result = handler(state)
return result
Expand Down
7 changes: 7 additions & 0 deletions tests/session/cmd/test_show_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,3 +219,10 @@ def test_show_config_timeout_custom(tox_project: ToxProjectCreator) -> None:
def test_show_config_help(tox_project: ToxProjectCreator) -> None:
outcome = tox_project({"tox.ini": ""}).run("c", "-h")
outcome.assert_success()


def test_show_config_core_host_python(tox_project: ToxProjectCreator) -> None:
project = tox_project({"tox.ini": ""})
outcome = project.run("c", "--core", "-e", "py", "-k", "host_python")
outcome.assert_success()
assert f"host_python = {sys.executable}" in outcome.out

0 comments on commit 159e6b5

Please sign in to comment.