Skip to content

Commit

Permalink
style: Apply ruff 0.8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
samjwu committed Dec 24, 2024
1 parent 6febef6 commit 47722ac
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/rocm_docs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ def setup(self) -> None:
self.html_theme = "rocm_docs_theme"


__all__ = ["setup", "ROCmDocs"]
__all__ = ["ROCmDocs", "setup"]
4 changes: 2 additions & 2 deletions src/rocm_docs/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def copy_from_package(
__all__ = [
"InvalidGitRepositoryError",
"VersionType",
"get_path_to_docs",
"get_branch",
"copy_from_package",
"get_branch",
"get_path_to_docs",
]
18 changes: 9 additions & 9 deletions tests/log_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,21 @@ def new_scope(self, *, when: TestPhase = "call") -> Scope:
return self.Scope(self, self.push(when=when), contextlib.ExitStack())


@pytest.fixture()
@pytest.fixture
def log_handler_stack(
caplog: pytest.LogCaptureFixture, _with_sphinx_logs: None
) -> LogStackFixture:
"""A fixture allowing scoped log handling"""
return LogStackFixture(caplog)


@pytest.fixture()
@pytest.fixture
def expected_logs_impl() -> set[logging.LogRecord]:
"""Implementation of expected_logs"""
return set()


@pytest.fixture()
@pytest.fixture
def _no_unexpected_warnings_impl(
request: pytest.FixtureRequest,
log_handler_stack: LogStackFixture,
Expand Down Expand Up @@ -140,7 +140,7 @@ def validate(self, records: Iterable[logging.LogRecord]) -> None:

# Must request no_unexpected_warnings_ to ensure its teardown runs *after*
# other fixtures that request expected_logs
@pytest.fixture()
@pytest.fixture
def expected_logs(
_no_unexpected_warnings_impl: None,
expected_logs_impl: set[logging.LogRecord],
Expand All @@ -149,7 +149,7 @@ def expected_logs(
return expected_logs_impl


@pytest.fixture()
@pytest.fixture
def _no_unexpected_warnings(
_no_unexpected_warnings_impl: None,
) -> None:
Expand Down Expand Up @@ -253,7 +253,7 @@ def __call__(
)


@pytest.fixture()
@pytest.fixture
def expect_log(
log_handler_stack: LogStackFixture, expected_logs: set[logging.LogRecord]
) -> ExpectLogFixture:
Expand All @@ -266,18 +266,18 @@ def expect_log(
return ExpectLogFixture(log_handler_stack, expected_logs)


@pytest.fixture()
@pytest.fixture
def _with_sphinx_logs(monkeypatch: pytest.MonkeyPatch) -> None:
"""Fixture to enable capturing sphinx logs in pytest"""
monkeypatch.setattr("sphinx.util.logging.setup", unittest.mock.Mock())


__all__ = [
"_no_unexpected_warnings_impl",
"_no_unexpected_warnings",
"_no_unexpected_warnings_impl",
"_with_sphinx_logs",
"expect_log",
"expected_logs_impl",
"expected_logs",
"expected_logs_impl",
"log_handler_stack",
]
4 changes: 2 additions & 2 deletions tests/projects_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import rocm_docs.projects


@pytest.fixture()
@pytest.fixture
def mock_projects(
monkeypatch: pytest.MonkeyPatch,
) -> Callable[[dict[str, rocm_docs.projects._Project]], None]:
Expand All @@ -24,7 +24,7 @@ def do_mock(projects: dict[str, rocm_docs.projects._Project]) -> None:
return do_mock


@pytest.fixture()
@pytest.fixture
def mocked_projects(
mock_projects: Callable[[dict[str, rocm_docs.projects._Project]], None],
) -> dict[str, rocm_docs.projects._Project]:
Expand Down
6 changes: 3 additions & 3 deletions tests/sphinx_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from .log_fixtures import ExpectLogFixture


@pytest.fixture()
@pytest.fixture
def with_no_git_repo(
monkeypatch: pytest.MonkeyPatch,
expect_log: ExpectLogFixture,
Expand Down Expand Up @@ -42,7 +42,7 @@ def build_sphinx(
app.build()


@pytest.fixture()
@pytest.fixture
def build_factory(
request: pytest.FixtureRequest,
tmp_path: Path,
Expand All @@ -69,4 +69,4 @@ def make(src_folder: Path, /) -> tuple[Path, Path]:
return make


__all__ = ["with_no_git_repo", "build_factory"]
__all__ = ["build_factory", "with_no_git_repo"]
2 changes: 1 addition & 1 deletion tests/test_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_scope_of_log_stack(expect_log: ExpectLogFixture) -> None:


@pytest.mark.usefixtures("_no_unexpected_warnings")
@pytest.mark.meta_invert_fixture()
@pytest.mark.meta_invert_fixture
def test_unexpected_warnings() -> None:
logger.warning("An unexpected warning")

Expand Down

0 comments on commit 47722ac

Please sign in to comment.