Skip to content

Commit

Permalink
chore(ruff) Fix strict linting issues (ruff 0.7.0)
Browse files Browse the repository at this point in the history
Fixed 12 errors:
- docs/conf.py:
    2 × UP031 (printf-string-formatting)
- src/doctest_docutils.py:
    4 × UP031 (printf-string-formatting)
    3 × UP032 (f-string)
- src/pytest_doctest_docutils.py:
    1 × I001 (unsorted-imports)
- tests/conftest.py:
    1 × PT001 (pytest-fixture-incorrect-parentheses-style)
- tests/test_doctest_docutils.py:
    1 × I001 (unsorted-imports)

Found 219 errors (12 fixed, 205 remaining).
1 file reformatted, 10 files left unchanged
  • Loading branch information
tony committed Oct 19, 2024
1 parent 39faec6 commit 74f47ad
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 17 deletions.
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
project = about["__title__"]
project_copyright = about["__copyright__"]

version = "%s" % (".".join(about["__version__"].split("."))[:2])
release = "%s" % (about["__version__"])
version = "{}".format(".".join(about["__version__"].split("."))[:2])
release = "{}".format(about["__version__"])

exclude_patterns = ["_build"]

Expand Down
27 changes: 14 additions & 13 deletions src/doctest_docutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ def run(self) -> t.List[Node]:
prefix, option_name = option[0], option[1:]
if prefix not in "+-":
self.state.document.reporter.warning(
"missing '+' or '-' in '%s' option." % option,
f"missing '+' or '-' in '{option}' option.",
line=self.lineno,
)
continue
if option_name not in doctest.OPTIONFLAGS_BY_NAME:
self.state.document.reporter.warning(
"'%s' is not a valid option." % option_name,
f"'{option_name}' is not a valid option.",
line=self.lineno,
)
continue
Expand All @@ -125,7 +125,7 @@ def run(self) -> t.List[Node]:
node["options"][flag] = True # Skip the test
except InvalidSpecifier:
self.state.document.reporter.warning(
"'%s' is not a valid pyversion option" % spec,
f"'{spec}' is not a valid pyversion option",
line=self.lineno,
)
if "skipif" in self.options:
Expand Down Expand Up @@ -288,16 +288,17 @@ def _find(

# Find a test for this string, and add it to the list of tests.
logger.debug(
"_find(%s)"
% pprint.pformat(
{
"tests": tests,
"string": string,
"name": name,
"source_lines": source_lines,
"globs": globs,
"seen": seen,
},
"_find({})".format(
pprint.pformat(
{
"tests": tests,
"string": string,
"name": name,
"source_lines": source_lines,
"globs": globs,
"seen": seen,
},
)
),
)
ext = pathlib.Path(name).suffix
Expand Down
1 change: 1 addition & 0 deletions src/pytest_doctest_docutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import pytest
from _pytest import outcomes
from _pytest.outcomes import OutcomeException

from doctest_docutils import DocutilsDocTestFinder, setup

if t.TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __call__(
...


@pytest.fixture()
@pytest.fixture
def make_app_params(
request: pytest.FixtureRequest,
app_params: AppParams,
Expand Down
3 changes: 2 additions & 1 deletion tests/test_doctest_docutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
import textwrap
import typing as t

import doctest_docutils
import pytest

import doctest_docutils

FixtureFileDict = t.Dict[str, str]


Expand Down

0 comments on commit 74f47ad

Please sign in to comment.