Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ on:
pull_request:

jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: astral-sh/ruff-action@v3

Windows:
name: 'Windows (${{ matrix.python }})'
runs-on: 'windows-latest'
Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def setup(app):
# built documents.
#
# The short X.Y version.
import pytest_trio
import pytest_trio # noqa: E402

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

html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
Expand Down
11 changes: 11 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,14 @@ partial_branches = [
"if .* or not _t.TYPE_CHECKING:",
"if .* or not t.TYPE_CHECKING:",
]

[tool.ruff]
lint.extend-select = [
"ASYNC", # flake8-async
"C4", # flake8-comprehensions
"PERF", # Perflint
"PT", # flake8-pytest-style
]
lint.ignore = [
"ASYNC115", # `trio.lowlevel.checkpoint()` instead of `trio.sleep(0)`
]
2 changes: 1 addition & 1 deletion pytest_trio/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Top-level package for pytest-trio."""

from ._version import __version__
from ._version import __version__ # noqa: F401
from .plugin import trio_fixture

__all__ = ["trio_fixture"]
4 changes: 2 additions & 2 deletions pytest_trio/_tests/test_fixture_mistakes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from pytest_trio import trio_fixture
import pytest # noqa: F401
from pytest_trio import trio_fixture # noqa: F401

from .helpers import enable_trio_mode

Expand Down
6 changes: 3 additions & 3 deletions pytest_trio/_tests/test_trio_mode.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pytest
import pytest # noqa: F401

from .helpers import enable_trio_mode

Expand Down Expand Up @@ -139,7 +139,7 @@ async def test():


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

test_text = """
Expand All @@ -159,7 +159,7 @@ async def test():


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

test_text = """
Expand Down
2 changes: 1 addition & 1 deletion pytest_trio/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ async def run(self, test_ctx, contextvars_ctx):
for event in self.user_done_events:
await event.wait()
except BaseException as exc:
assert isinstance(exc, trio.Cancelled)
assert isinstance(exc, trio.Cancelled) # noqa: PT017
yield_outcome = outcome.Error(exc)
test_ctx.crash(self, None)
with trio.CancelScope(shield=True):
Expand Down
Loading