Skip to content

Commit

Permalink
Use hatch-autorun instead of coverage-enable-subprocess
Browse files Browse the repository at this point in the history
  • Loading branch information
hynek committed Dec 30, 2022
1 parent 08a9db7 commit 68ab2e0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 10 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ tests-no-zope = [
tests = ["attrs[tests-no-zope]", "zope.interface"]
cov = [
"attrs[tests]",
# Makes coverage work with pytest-xdist.
"coverage-enable-subprocess",
# Ensure coverage is new enough for `source_pkgs`.
"coverage>=5.3",
]
Expand Down Expand Up @@ -115,6 +113,16 @@ text = """
"""


# Make coverage play nicely with pytest-xdist.
[tool.hatch.build.targets.wheel.hooks.autorun]
dependencies = ["hatch-autorun"]
code = """
import coverage
coverage.process_startup()
"""
enable-by-default = false


[tool.pytest.ini_options]
addopts = ["-ra", "--strict-markers", "--strict-config"]
xfail_strict = true
Expand Down
4 changes: 3 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ commands = python -m pytest {posargs:-n auto}

[testenv:py37]
extras = cov
setenv = COVERAGE_PROCESS_START={toxinidir}/pyproject.toml
setenv =
HATCH_BUILD_HOOK_ENABLE_AUTORUN=1
COVERAGE_PROCESS_START={toxinidir}/pyproject.toml
commands = coverage run -m pytest {posargs:-n auto}


Expand Down

0 comments on commit 68ab2e0

Please sign in to comment.