Skip to content

Commit 16cacb0

Browse files
committed
Fix test failure with pyenv or mise pythons
1 parent 19750a0 commit 16cacb0

File tree

6 files changed

+47
-20
lines changed

6 files changed

+47
-20
lines changed

.config/pydoclint-baseline.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
tests/unit/test_treemaker.py
2+
DOC101: Method `SafeEnvBuilder.__init__`: Docstring contains fewer arguments than in function signature.
3+
DOC103: Method `SafeEnvBuilder.__init__`: Docstring arguments are different from function arguments. (Or could be other formatting issues: https://jsh9.github.io/pydoclint/violation_codes.html#notes-on-doc103 ). Arguments in the function signature but not in the docstring: [clear: bool, prompt: str | None, symlinks: bool, system_site_packages: bool, upgrade: bool, upgrade_deps: bool, with_pip: bool].
4+
--------------------

.github/workflows/tox.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ jobs:
1919
uses: ansible/team-devtools/.github/workflows/tox.yml@main
2020
with:
2121
max_python: "3.13"
22-
jobs_producing_coverage: 7
22+
jobs_producing_coverage: 8
2323
other_names: |
2424
docs
2525
lint
2626
pkg
2727
py313-milestone
28+
py-mise:tox -e py:mise=true

.readthedocs.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,12 @@ mkdocs:
66
configuration: mkdocs.yml
77

88
build:
9-
os: ubuntu-22.04
9+
os: ubuntu-24.04
1010
tools:
11-
python: "3.11"
11+
python: "3.13"
1212
commands:
13-
- pip install --user tox
14-
- python3 -m tox -e docs -- --strict --site-dir=_readthedocs/html/
15-
python:
16-
install:
17-
- method: pip
18-
path: tox
19-
- method: pip
20-
path: .
21-
extra_requirements:
22-
- docs
13+
- python3 -m pip install --user tox
14+
- python3 -m tox -e docs
2315
submodules:
2416
include: all
2517
recursive: true

.tool-versions

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# mise: 'latest' for python might pick 3.13.0t which is not yet supported
2+
python 3.13.0

tests/unit/test_treemaker.py

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,33 @@
1919
from ansible_dev_environment.utils import JSONVal
2020

2121

22+
class SafeEnvBuilder(EnvBuilder):
23+
"""Safer EnvBuilder that defaults symlinks to True."""
24+
25+
# pylint: disable=too-many-arguments
26+
def __init__( # noqa: PLR0913
27+
self,
28+
*,
29+
system_site_packages: bool = False,
30+
clear: bool = False,
31+
symlinks: bool = True,
32+
upgrade: bool = False,
33+
with_pip: bool = False,
34+
prompt: str | None = None,
35+
upgrade_deps: bool = False,
36+
) -> None:
37+
"""Ensure that symlinks defaults to True because otherwise it will create broken venvs with tools like pyenv, asdf or mise."""
38+
super().__init__(
39+
system_site_packages=system_site_packages,
40+
clear=clear,
41+
symlinks=symlinks,
42+
upgrade=upgrade,
43+
with_pip=with_pip,
44+
prompt=prompt,
45+
upgrade_deps=upgrade_deps,
46+
)
47+
48+
2249
def test_tree_empty(
2350
capsys: pytest.CaptureFixture[str],
2451
output: Output,
@@ -32,7 +59,8 @@ def test_tree_empty(
3259
tmp_path: Pytest fixture.
3360
"""
3461
venv_path = tmp_path / "venv"
35-
EnvBuilder().create(venv_path)
62+
env = SafeEnvBuilder()
63+
env.create(venv_path)
3664

3765
args = Namespace(
3866
venv=venv_path,
@@ -63,7 +91,7 @@ def test_tree_malformed_info(
6391
tmp_path: Pytest fixture.
6492
"""
6593
venv_path = tmp_path / "venv"
66-
EnvBuilder().create(venv_path)
94+
SafeEnvBuilder().create(venv_path)
6795

6896
args = Namespace(
6997
venv=venv_path,
@@ -118,7 +146,7 @@ def test_tree_malformed_deps(
118146
tmp_path: Pytest fixture.
119147
"""
120148
venv_path = tmp_path / "venv"
121-
EnvBuilder().create(venv_path)
149+
SafeEnvBuilder().create(venv_path)
122150

123151
args = Namespace(
124152
venv=venv_path,
@@ -175,7 +203,7 @@ def test_tree_malformed_deps_not_string(
175203
tmp_path: Pytest fixture.
176204
"""
177205
venv_path = tmp_path / "venv"
178-
EnvBuilder().create(venv_path)
206+
SafeEnvBuilder().create(venv_path)
179207

180208
args = Namespace(
181209
venv=venv_path,
@@ -232,7 +260,7 @@ def test_tree_malformed_repo_not_string(
232260
capsys: Pytest stdout capture fixture.
233261
"""
234262
venv_path = tmp_path / "venv"
235-
EnvBuilder().create(venv_path)
263+
SafeEnvBuilder().create(venv_path)
236264

237265
args = Namespace(
238266
venv=venv_path,

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ allowlist_externals =
5151

5252
[testenv:deps]
5353
description = Bump all dependencies
54-
base_python = python3.10
54+
base_python = python3.11
5555
skip_install = true
5656
deps =
5757
{[testenv:lint]deps}
@@ -75,7 +75,7 @@ set_env =
7575
NO_COLOR = 1
7676
TERM = dump
7777
commands =
78-
mkdocs build {posargs:}
78+
mkdocs build --strict --site-dir=_readthedocs/html/ {posargs:}
7979

8080
[testenv:lint]
8181
description = Enforce quality standards under {basepython}

0 commit comments

Comments
 (0)