Skip to content

Commit

Permalink
Enable support for python 3.13 and 3.13 (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea authored Nov 11, 2024
1 parent 4be0e55 commit 938d220
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 44 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
tox:
uses: ansible/team-devtools/.github/workflows/tox.yml@main
with:
jobs_producing_coverage: 6
other_names: |
docs
lint
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ test-distribute.sh
/.pytest_cache
venv/*
src/tendo/_version.py
coverage.lcov
18 changes: 10 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,20 @@ build-backend = "setuptools.build_meta"
[tool.black]
target-version = ["py38"]

[tool.coverage.report]
exclude_lines = ["pragma: no cover", "if TYPE_CHECKING:"]
fail_under = 100
skip_covered = true
show_missing = true

[tool.coverage.run]
source_pkgs = ["tendo"]
branch = true
source = ["src"]
# Do not use branch until bug is fixes:
# https://github.com/nedbat/coveragepy/issues/605
branch = false
parallel = true
concurrency = ["multiprocessing", "thread"]

[tool.coverage.paths]
source = ["src", ".tox/*/site-packages"]

[tool.coverage.report]
exclude_lines = ["pragma: no cover", "if TYPE_CHECKING:"]

[tool.isort]
profile = "black"
add_imports = "from __future__ import annotations"
Expand Down
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ classifier =
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: 3.13
Topic :: Software Development :: Libraries :: Python Modules
Topic :: Internet :: WWW/HTTP

Expand Down Expand Up @@ -52,6 +54,7 @@ test =
coverage[toml]>=6.5.0
coveralls~=3.3.1
pre-commit>=3.3.3
pip
pytest-cache~=1.0
pytest-cov~=3.0.0
pytest-html~=3.1.1
Expand Down
4 changes: 2 additions & 2 deletions src/tendo/tee.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import codecs
import logging
import os
import pipes
from shlex import quote
import subprocess
import sys
import time
Expand Down Expand Up @@ -57,7 +57,7 @@ def system2(
# because collections.Iterable seems to be missing on Debian Python 2.5.5
# (but not on OS X 10.8 with Python 2.5.6)
if hasattr(cmd, "__iter__"):
cmd = " ".join(pipes.quote(s) for s in cmd)
cmd = " ".join(quote(s) for s in cmd)

t = time.process_time()
output = []
Expand Down
67 changes: 33 additions & 34 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,45 +11,44 @@ isolated_build = True

[testenv]
sitepackages=False
commands_pre =
# safety measure to assure we do not accidentally run tests with broken dependencies
{envpython} -m pip check
# cleaning needed to prevent errors between runs
sh -c "rm -f {envdir}/.coverage.* 2>/dev/null || true"
commands=
# We add coverage options but not making them mandatory as we do not want to force
# pytest users to run coverage when they just want to run a single test with `pytest -k test`
coverage run -m pytest {posargs:}
# needed for upload to codecov.io
{py,py39,py310,py311,py312,py313}: sh -c "coverage combine -q --data-file={envdir}/.coverage {envdir}/.coverage.* && coverage xml --data-file={envdir}/.coverage -o {envdir}/coverage.xml --ignore-errors --fail-under=0 && COVERAGE_FILE={envdir}/.coverage coverage lcov --fail-under=0 --ignore-errors -q && COVERAGE_FILE={envdir}/.coverage coverage report --fail-under=0 --ignore-errors"
# lcov needed for vscode integration due to https://github.com/ryanluker/vscode-coverage-gutters/issues/403
editable = true
extras = test
passenv =
CURL_CA_BUNDLE # https proxies, https://github.com/tox-dev/tox/issues/1437
FORCE_COLOR
HOME
LANG
LC_ALL
LC_CTYPE
NO_COLOR
PYENV_VERSION
PYTEST_* # allows developer to define their own preferences
PYTEST_REQPASS # needed for CI
PY_*
PY_COLORS
REQUESTS_CA_BUNDLE # https proxies
RTD_TOKEN
RTOX*
SSH_AUTH_SOCK
SSL_CERT_FILE # https proxies
CURL_CA_BUNDLE # https proxies, https://github.com/tox-dev/tox/issues/1437
FORCE_COLOR
HOME
NO_COLOR
PYTEST_* # allows developer to define their own preferences
PYTEST_REQPASS # needed for CI
PYTHON* # PYTHONPYCACHEPREFIX, PYTHONIOENCODING, PYTHONBREAKPOINT,...
PY_COLORS
RTD_TOKEN
REQUESTS_CA_BUNDLE # https proxies
SETUPTOOLS_SCM_DEBUG
SSL_CERT_FILE # https proxies
SSH_AUTH_SOCK # may be needed by git
LANG
LC_*
setenv =
COVERAGE_FILE={env:COVERAGE_FILE:{toxworkdir}/.coverage.{envname}}
COVERAGE_PROCESS_START={toxinidir}/pyproject.toml
commands=
coverage run -m pytest --color=yes --html={envlogdir}/report.html --self-contained-html
# --pyargs tendo
COVERAGE_FILE = {env:COVERAGE_FILE:{envdir}/.coverage.{envname}}
COVERAGE_PROCESS_START={toxinidir}/pyproject.toml
PIP_DISABLE_PIP_VERSION_CHECK = 1
allowlist_externals =
sh
deps =
--editable .[test]

[testenv:coverage]
description = Combines and displays coverage results
commands =
sh -c "coverage combine .tox/.coverage.*"
# needed by codecov github actions:
coverage xml
# just for humans running it:
coverage report --skip-covered --fail-under=43
deps =
coverage[toml]>=6.5.0


[testenv:docs]
changedir=docs
Expand Down

0 comments on commit 938d220

Please sign in to comment.