Skip to content

Commit 257f24b

Browse files
authored
Merge branch 'master' into trio_run-for-trio_asyncio
2 parents 242139d + f016850 commit 257f24b

12 files changed

Lines changed: 140 additions & 93 deletions

File tree

.coveragerc

Lines changed: 0 additions & 9 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,27 @@ on:
77
pull_request:
88

99
jobs:
10+
ruff:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v5
14+
- uses: astral-sh/ruff-action@v3
15+
1016
Windows:
1117
name: 'Windows (${{ matrix.python }})'
1218
runs-on: 'windows-latest'
1319
strategy:
1420
fail-fast: false
1521
matrix:
16-
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
22+
python: ['3.10', '3.11', '3.12', '3.13', '3.14']
1723
steps:
1824
- name: Checkout
19-
uses: actions/checkout@v2
20-
- name: Setup python
21-
uses: actions/setup-python@v2
25+
uses: actions/checkout@v5
26+
- name: Setup Python ${{ matrix.python }}'
27+
uses: actions/setup-python@v6
2228
with:
2329
python-version: '${{ matrix.python }}'
30+
allow-prereleases: true
2431
- name: Run tests
2532
run: ./ci.sh
2633
shell: bash
@@ -35,30 +42,25 @@ jobs:
3542
strategy:
3643
fail-fast: false
3744
matrix:
38-
python: ['pypy-3.8', '3.8', 'pypy-3.9', '3.9', 'pypy-3.10', '3.10', '3.11', '3.12']
45+
python: ['3.10', '3.11', '3.12', '3.13', '3.14', 'pypy-3.11']
3946
check_formatting: ['0']
4047
check_docs: ['0']
4148
extra_name: ['']
4249
include:
43-
- python: '3.9'
50+
- python: '3.x'
4451
check_formatting: '1'
4552
extra_name: ', check formatting'
46-
- python: '3.9'
53+
- python: '3.12' # sphinx-build: cgi module was removed in 3.13
4754
check_docs: '1'
4855
extra_name: ', check docs'
4956
steps:
5057
- name: Checkout
51-
uses: actions/checkout@v2
52-
- name: Setup python
53-
uses: actions/setup-python@v2
54-
if: "!endsWith(matrix.python, '-dev')"
55-
with:
56-
python-version: '${{ matrix.python }}'
57-
- name: Setup python (dev)
58-
uses: deadsnakes/action@v2.0.2
59-
if: endsWith(matrix.python, '-dev')
58+
uses: actions/checkout@v5
59+
- name: Setup Python ${{ matrix.python }}
60+
uses: actions/setup-python@v6
6061
with:
6162
python-version: '${{ matrix.python }}'
63+
allow-prereleases: true
6264
- name: Run tests
6365
run: ./ci.sh
6466
env:
@@ -74,14 +76,15 @@ jobs:
7476
strategy:
7577
fail-fast: false
7678
matrix:
77-
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
79+
python: ['3.10', '3.11', '3.12', '3.13', '3.14']
7880
steps:
7981
- name: Checkout
80-
uses: actions/checkout@v2
81-
- name: Setup python
82-
uses: actions/setup-python@v2
82+
uses: actions/checkout@v5
83+
- name: Setup Python ${{ matrix.python }}
84+
uses: actions/setup-python@v6
8385
with:
8486
python-version: '${{ matrix.python }}'
87+
allow-prereleases: true
8588
- name: Run tests
8689
run: ./ci.sh
8790
env:

.readthedocs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version: 2
44
build:
55
os: ubuntu-22.04
66
tools:
7-
python: "3.9"
7+
python: "3.12" # sphinx-build: cgi module was removed in 3.13
88

99
formats:
1010
- htmlzip
@@ -15,4 +15,5 @@ python:
1515
- requirements: docs-requirements.txt
1616

1717
sphinx:
18+
configuration: docs/source/conf.py
1819
fail_on_warning: true

ci.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ function curl-harder() {
2323
}
2424

2525

26-
python -m pip install -U pip setuptools wheel
26+
python -m pip install -U pip build
2727
python -m pip --version
2828

29-
python setup.py sdist --formats=zip
30-
python -m pip install dist/*.zip
29+
python -m build
30+
python -m pip install dist/*.whl
3131

3232
if [ "$CHECK_FORMATTING" = "1" ]; then
3333
pip install black

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def setup(app):
101101
# built documents.
102102
#
103103
# The short X.Y version.
104-
import pytest_trio
104+
import pytest_trio # noqa: E402
105105

106106
version = pytest_trio.__version__
107107
# The full version, including alpha/beta/rc tags.
@@ -143,7 +143,7 @@ def setup(app):
143143
# We have to set this ourselves, not only because it's useful for local
144144
# testing, but also because if we don't then RTD will throw away our
145145
# html_theme_options.
146-
import sphinx_rtd_theme
146+
import sphinx_rtd_theme # noqa: E402
147147

148148
html_theme = "sphinx_rtd_theme"
149149
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

pyproject.toml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,109 @@
1+
[build-system]
2+
requires = ["setuptools >= 64"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "pytest-trio"
7+
dynamic = ["version"]
8+
authors = [
9+
{ name="Emmanuel Leblond", email="emmanuel.leblond@gmail.com" },
10+
]
11+
description = "Pytest plugin for trio"
12+
readme = {file = "README.md", content-type = "text/markdown"}
13+
license = {file = "LICENSE"}
14+
requires-python = ">=3.10"
15+
classifiers = [
16+
"Development Status :: 4 - Beta",
17+
"License :: OSI Approved :: MIT License",
18+
"License :: OSI Approved :: Apache Software License",
19+
"Natural Language :: English",
20+
"Programming Language :: Python :: 3",
21+
"Programming Language :: Python :: 3.10",
22+
"Programming Language :: Python :: 3.11",
23+
"Programming Language :: Python :: 3.12",
24+
"Programming Language :: Python :: 3.13",
25+
"Programming Language :: Python :: 3.14",
26+
"Programming Language :: Python :: 3 :: Only",
27+
"Programming Language :: Python :: Implementation :: CPython",
28+
"Programming Language :: Python :: Implementation :: PyPy",
29+
"Operating System :: POSIX :: Linux",
30+
"Operating System :: MacOS :: MacOS X",
31+
"Operating System :: Microsoft :: Windows",
32+
"Operating System :: OS Independent",
33+
"Topic :: System :: Networking",
34+
"Topic :: Software Development :: Testing",
35+
"Framework :: Hypothesis",
36+
"Framework :: Pytest",
37+
"Framework :: Trio",
38+
]
39+
keywords = [
40+
"async",
41+
"pytest",
42+
"testing",
43+
"trio",
44+
]
45+
dependencies = [
46+
"trio >= 0.25.1", # for upstream Hypothesis integration
47+
"outcome >= 1.1.0",
48+
"pytest >= 7.2.0", # for ExceptionGroup support
49+
]
50+
51+
[tool.setuptools.dynamic]
52+
version = {attr = "pytest_trio._version.__version__"}
53+
54+
[project.urls]
55+
"Homepage" = "https://github.com/python-trio/pytest-trio"
56+
"Source" = "https://github.com/python-trio/pytest-trio"
57+
"Bug Tracker" = "https://github.com/python-trio/pytest-trio/issues"
58+
59+
[project.entry-points.pytest11]
60+
trio = "pytest_trio.plugin"
61+
62+
[tool.setuptools.packages]
63+
find = {namespaces = false}
64+
165
[tool.towncrier]
266
package = "pytest_trio"
367
filename = "docs/source/history.rst"
468
directory = "newsfragments"
569
title_format = "pytest-trio {version} ({project_date})"
670
underlines = ["-", "~", "^"]
771
issue_format = "`#{issue} <https://github.com/python-trio/pytest-trio/issues/{issue}>`__"
72+
73+
[tool.coverage.run]
74+
branch = true
75+
source_pkgs = ["pytest_trio"]
76+
77+
[tool.coverage.report]
78+
precision = 1
79+
skip_covered = true
80+
exclude_lines = [
81+
"pragma: no cover",
82+
"abc.abstractmethod",
83+
"if TYPE_CHECKING.*:",
84+
"if _t.TYPE_CHECKING:",
85+
"if t.TYPE_CHECKING:",
86+
"@overload",
87+
'class .*\bProtocol\b.*\):',
88+
"raise NotImplementedError",
89+
]
90+
partial_branches = [
91+
"pragma: no branch",
92+
"if not TYPE_CHECKING:",
93+
"if not _t.TYPE_CHECKING:",
94+
"if not t.TYPE_CHECKING:",
95+
"if .* or not TYPE_CHECKING:",
96+
"if .* or not _t.TYPE_CHECKING:",
97+
"if .* or not t.TYPE_CHECKING:",
98+
]
99+
100+
[tool.ruff]
101+
lint.extend-select = [
102+
"ASYNC", # flake8-async
103+
"C4", # flake8-comprehensions
104+
"PERF", # Perflint
105+
"PT", # flake8-pytest-style
106+
]
107+
lint.ignore = [
108+
"ASYNC115", # `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
109+
]

pytest_trio/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Top-level package for pytest-trio."""
22

3-
from ._version import __version__
3+
from ._version import __version__ # noqa: F401
44
from .plugin import trio_fixture
55

66
__all__ = ["trio_fixture"]

pytest_trio/_tests/test_fixture_mistakes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import pytest
2-
from pytest_trio import trio_fixture
1+
import pytest # noqa: F401
2+
from pytest_trio import trio_fixture # noqa: F401
33

44
from .helpers import enable_trio_mode
55

pytest_trio/_tests/test_trio_mode.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import pytest
1+
import pytest # noqa: F401
22

33
from .helpers import enable_trio_mode
44

@@ -164,7 +164,7 @@ async def test():
164164

165165

166166
def test_closest_explicit_run_wins(testdir):
167-
testdir.makefile(".ini", pytest=f"[pytest]\ntrio_mode = true\ntrio_run = trio\n")
167+
testdir.makefile(".ini", pytest="[pytest]\ntrio_mode = true\ntrio_run = trio\n")
168168
testdir.makepyfile(qtrio=qtrio_text)
169169

170170
test_text = """
@@ -184,7 +184,7 @@ async def test():
184184

185185

186186
def test_ini_run_wins_with_blank_marker(testdir):
187-
testdir.makefile(".ini", pytest=f"[pytest]\ntrio_mode = true\ntrio_run = qtrio\n")
187+
testdir.makefile(".ini", pytest="[pytest]\ntrio_mode = true\ntrio_run = qtrio\n")
188188
testdir.makepyfile(qtrio=qtrio_text)
189189

190190
test_text = """

pytest_trio/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# This file is imported from __init__.py and exec'd from setup.py
1+
# This file is imported from __init__.py and parsed by setuptools
22

33
__version__ = "0.8.0+dev"

0 commit comments

Comments
 (0)