Skip to content

Commit

Permalink
WIP enable flake8-pytest-style
Browse files Browse the repository at this point in the history
  • Loading branch information
CoolCat467 committed Oct 19, 2023
1 parent b324b3a commit f7eabe2
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ select = [
"F", # pyflakes
"I", # isort
"YTT", # flake8-2020
"PT", # flake8-pytest-style
]
extend-ignore = [
'F403', # undefined-local-with-import-star
Expand Down
2 changes: 1 addition & 1 deletion trio/_core/_tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def drain_socket(sock: stdlib_socket.socket) -> None:
RetT = TypeVar("RetT")


@pytest.fixture
@pytest.fixture()
def socketpair() -> Generator[SocketPair, None, None]:
pair = stdlib_socket.socketpair()
for sock in pair:
Expand Down
4 changes: 2 additions & 2 deletions trio/_tests/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ def pytest_configure(config: pytest.Config) -> None:
SKIP_OPTIONAL_IMPORTS = config.getoption("--skip-optional-imports", default=False)


@pytest.fixture
@pytest.fixture()
def mock_clock() -> MockClock:
return MockClock()


@pytest.fixture
@pytest.fixture()
def autojump_clock() -> MockClock:
return MockClock(autojump_threshold=0)

Expand Down
2 changes: 1 addition & 1 deletion trio/_tests/test_deprecate.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from . import module_with_deprecations


@pytest.fixture
@pytest.fixture()
def recwarn_always(recwarn: pytest.WarningsRecorder) -> pytest.WarningsRecorder:
warnings.simplefilter("always")
# ResourceWarnings about unclosed sockets can occur nondeterministically
Expand Down
4 changes: 2 additions & 2 deletions trio/_tests/test_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def iter_modules(
# they might be using a newer version of Python with additional symbols which
# won't be reflected in trio.socket, and this shouldn't cause downstream test
# runs to start failing.
@pytest.mark.redistributors_should_skip
@pytest.mark.redistributors_should_skip()
# Static analysis tools often have trouble with alpha releases, where Python's
# internals are in flux, grammar may not have settled down, etc.
@pytest.mark.skipif(
Expand Down Expand Up @@ -263,7 +263,7 @@ def no_underscores(symbols):
# modules, instead of once per class.
@slow
# see comment on test_static_tool_sees_all_symbols
@pytest.mark.redistributors_should_skip
@pytest.mark.redistributors_should_skip()
# Static analysis tools often have trouble with alpha releases, where Python's
# internals are in flux, grammar may not have settled down, etc.
@pytest.mark.skipif(
Expand Down
6 changes: 3 additions & 3 deletions trio/_tests/test_file_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@
from trio._file_io import _FILE_ASYNC_METHODS, _FILE_SYNC_ATTRS, AsyncIOWrapper


@pytest.fixture
@pytest.fixture()
def path(tmp_path: pathlib.Path) -> str:
return os.fspath(tmp_path / "test")


@pytest.fixture
@pytest.fixture()
def wrapped():
return mock.Mock(spec_set=io.StringIO)


@pytest.fixture
@pytest.fixture()
def async_file(wrapped):
return trio.wrap_file(wrapped)

Expand Down
2 changes: 1 addition & 1 deletion trio/_tests/test_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from trio._path import AsyncAutoWrapperType as WrapperType


@pytest.fixture
@pytest.fixture()
def path(tmp_path: pathlib.Path) -> trio.Path:
return trio.Path(tmp_path / "test")

Expand Down
2 changes: 1 addition & 1 deletion trio/_tests/test_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def getaddrinfo(self, *args: Any, **kwargs: Any) -> getaddrinfoResponse | str:
raise RuntimeError(f"gai called with unexpected arguments {bound}")


@pytest.fixture
@pytest.fixture()
def monkeygai(monkeypatch: pytest.MonkeyPatch) -> MonkeypatchedGAI:
controller = MonkeypatchedGAI(stdlib_socket.getaddrinfo)
monkeypatch.setattr(stdlib_socket, "getaddrinfo", controller.getaddrinfo)
Expand Down

0 comments on commit f7eabe2

Please sign in to comment.