diff --git a/.config/pydoclint-baseline.txt b/.config/pydoclint-baseline.txt index e69de29..2688bd4 100644 --- a/.config/pydoclint-baseline.txt +++ b/.config/pydoclint-baseline.txt @@ -0,0 +1,4 @@ +tests/unit/test_treemaker.py + DOC101: Method `SafeEnvBuilder.__init__`: Docstring contains fewer arguments than in function signature. + 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]. +-------------------- diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index e5c303b..740cc0b 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -19,9 +19,10 @@ jobs: uses: ansible/team-devtools/.github/workflows/tox.yml@main with: max_python: "3.13" - jobs_producing_coverage: 7 + jobs_producing_coverage: 8 other_names: | docs lint pkg py313-milestone + py-mise:tox -e py:mise=true diff --git a/.gitignore b/.gitignore index 1b1aca1..a22a1cb 100644 --- a/.gitignore +++ b/.gitignore @@ -169,3 +169,4 @@ cython_debug/ /src/*/_version.py .DS_Store +_readthedocs/ diff --git a/.readthedocs.yml b/.readthedocs.yml index 78a84d9..6c43091 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -6,20 +6,12 @@ mkdocs: configuration: mkdocs.yml build: - os: ubuntu-22.04 + os: ubuntu-24.04 tools: - python: "3.11" + python: "3.13" commands: - - pip install --user tox - - python3 -m tox -e docs -- --strict --site-dir=_readthedocs/html/ -python: - install: - - method: pip - path: tox - - method: pip - path: . - extra_requirements: - - docs + - python3 -m pip install --user tox + - python3 -m tox -e docs submodules: include: all recursive: true diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..846338a --- /dev/null +++ b/.tool-versions @@ -0,0 +1,2 @@ +# mise: 'latest' for python might pick 3.13.0t which is not yet supported +python 3.13.0 diff --git a/tests/unit/test_treemaker.py b/tests/unit/test_treemaker.py index aaa5fa0..e50f83d 100644 --- a/tests/unit/test_treemaker.py +++ b/tests/unit/test_treemaker.py @@ -19,6 +19,33 @@ from ansible_dev_environment.utils import JSONVal +class SafeEnvBuilder(EnvBuilder): + """Safer EnvBuilder that defaults symlinks to True.""" + + # pylint: disable=too-many-arguments + def __init__( # noqa: PLR0913 + self, + *, + system_site_packages: bool = False, + clear: bool = False, + symlinks: bool = True, + upgrade: bool = False, + with_pip: bool = False, + prompt: str | None = None, + upgrade_deps: bool = False, + ) -> None: + """Ensure that symlinks defaults to True because otherwise it will create broken venvs with tools like pyenv, asdf or mise.""" + super().__init__( + system_site_packages=system_site_packages, + clear=clear, + symlinks=symlinks, + upgrade=upgrade, + with_pip=with_pip, + prompt=prompt, + upgrade_deps=upgrade_deps, + ) + + def test_tree_empty( capsys: pytest.CaptureFixture[str], output: Output, @@ -32,7 +59,8 @@ def test_tree_empty( tmp_path: Pytest fixture. """ venv_path = tmp_path / "venv" - EnvBuilder().create(venv_path) + env = SafeEnvBuilder() + env.create(venv_path) args = Namespace( venv=venv_path, @@ -63,7 +91,7 @@ def test_tree_malformed_info( tmp_path: Pytest fixture. """ venv_path = tmp_path / "venv" - EnvBuilder().create(venv_path) + SafeEnvBuilder().create(venv_path) args = Namespace( venv=venv_path, @@ -118,7 +146,7 @@ def test_tree_malformed_deps( tmp_path: Pytest fixture. """ venv_path = tmp_path / "venv" - EnvBuilder().create(venv_path) + SafeEnvBuilder().create(venv_path) args = Namespace( venv=venv_path, @@ -175,7 +203,7 @@ def test_tree_malformed_deps_not_string( tmp_path: Pytest fixture. """ venv_path = tmp_path / "venv" - EnvBuilder().create(venv_path) + SafeEnvBuilder().create(venv_path) args = Namespace( venv=venv_path, @@ -232,7 +260,7 @@ def test_tree_malformed_repo_not_string( capsys: Pytest stdout capture fixture. """ venv_path = tmp_path / "venv" - EnvBuilder().create(venv_path) + SafeEnvBuilder().create(venv_path) args = Namespace( venv=venv_path, diff --git a/tox.ini b/tox.ini index 5d5db48..64e17c7 100644 --- a/tox.ini +++ b/tox.ini @@ -51,7 +51,7 @@ allowlist_externals = [testenv:deps] description = Bump all dependencies -base_python = python3.10 +base_python = python3.11 skip_install = true deps = {[testenv:lint]deps} @@ -75,7 +75,7 @@ set_env = NO_COLOR = 1 TERM = dump commands = - mkdocs build {posargs:} + mkdocs build --strict --site-dir=_readthedocs/html/ {posargs:} [testenv:lint] description = Enforce quality standards under {basepython}