Skip to content

Commit 089e7bb

Browse files
committed
Upgrade ruff.
1 parent ab2cd26 commit 089e7bb

File tree

5 files changed

+10
-11
lines changed

5 files changed

+10
-11
lines changed

.pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ exclude: '^(\.tox|ci/templates|\.bumpversion\.cfg)(/|$)'
66
# Note the order is intentional to avoid multiple passes of the hooks
77
repos:
88
- repo: https://github.com/astral-sh/ruff-pre-commit
9-
rev: v0.6.5
9+
rev: v0.11.2
1010
hooks:
1111
- id: ruff
1212
args: [--fix, --exit-non-zero-on-fix, --show-fixes, --unsafe-fixes]
1313
- id: ruff-format
1414
- repo: https://github.com/pre-commit/pre-commit-hooks
15-
rev: v4.6.0
15+
rev: v5.0.0
1616
hooks:
1717
- id: trailing-whitespace
1818
- id: end-of-file-fixer

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def finalize_options(self):
7272
def run(self):
7373
with Path(__file__).parent.joinpath('src', 'pytest-cov.pth').open('w') as fh:
7474
with Path(__file__).parent.joinpath('src', 'pytest-cov.embed').open() as sh:
75-
fh.write(f"import os, sys;exec({sh.read().replace(' ', ' ')!r})")
75+
fh.write(f'import os, sys;exec({sh.read().replace(" ", " ")!r})')
7676

7777

7878
setup(

src/pytest_cov/engine.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def summary(self, stream):
180180

181181
# Output coverage section header.
182182
if len(self.node_descs) == 1:
183-
self.sep(stream, '_', f"coverage: {''.join(self.node_descs)}")
183+
self.sep(stream, '_', f'coverage: {"".join(self.node_descs)}')
184184
else:
185185
self.sep(stream, '_', 'coverage')
186186
for node_desc in sorted(self.node_descs):
@@ -366,7 +366,7 @@ def testnodedown(self, node, error):
366366
# If worker is not collocated then we must save the data file
367367
# that it returns to us.
368368
if 'cov_worker_data' in output:
369-
data_suffix = '%s.%s.%06d.%s' % (
369+
data_suffix = '%s.%s.%06d.%s' % ( # noqa: UP031
370370
socket.gethostname(),
371371
os.getpid(),
372372
random.randint(0, 999999), # noqa: S311

src/pytest_cov/plugin.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ def validate_fail_under(num_str):
5656
raise argparse.ArgumentTypeError('An integer or float value is required.') from None
5757
if value > 100:
5858
raise argparse.ArgumentTypeError(
59-
'Your desire for over-achievement is admirable but misplaced. '
60-
'The maximum value is 100. Perhaps write more integration tests?'
59+
'Your desire for over-achievement is admirable but misplaced. The maximum value is 100. Perhaps write more integration tests?'
6160
)
6261
return value
6362

@@ -387,7 +386,7 @@ def pytest_terminal_summary(self, terminalreporter):
387386
self.write_heading(terminalreporter)
388387
failed = self.cov_total < self.options.cov_fail_under
389388
markup = {'red': True, 'bold': True} if failed else {'green': True}
390-
message = '{fail}Required test coverage of {required}% {reached}. ' 'Total coverage: {actual:.2f}%\n'.format(
389+
message = '{fail}Required test coverage of {required}% {reached}. Total coverage: {actual:.2f}%\n'.format(
391390
required=self.options.cov_fail_under,
392391
actual=self.cov_total,
393392
fail='FAIL ' if failed else '',
@@ -434,7 +433,7 @@ def switch_context(self, item, when):
434433

435434

436435
@pytest.fixture
437-
def no_cover(): # noqa: PT004
436+
def no_cover():
438437
"""A pytest fixture to disable coverage."""
439438

440439

tests/test_pytest_cov.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ def test_term_missing_output_dir(testdir):
414414

415415
result.stderr.fnmatch_lines(
416416
[
417-
'*argument --cov-report: output specifier not supported for: ' '"term-missing:%s"*' % DEST_DIR,
417+
'*argument --cov-report: output specifier not supported for: "term-missing:%s"*' % DEST_DIR,
418418
]
419419
)
420420
assert result.ret != 0
@@ -1773,7 +1773,7 @@ def bad_init():
17731773
monkeypatch.setattr(sys, 'stderr', buff)
17741774
monkeypatch.setitem(os.environ, 'COV_CORE_SOURCE', 'foobar')
17751775
exec(payload)
1776-
expected = 'pytest-cov: Failed to setup subprocess coverage. ' "Environ: {'COV_CORE_SOURCE': 'foobar'} Exception: SpecificError()\n"
1776+
expected = "pytest-cov: Failed to setup subprocess coverage. Environ: {'COV_CORE_SOURCE': 'foobar'} Exception: SpecificError()\n"
17771777
assert buff.getvalue() == expected
17781778

17791779

0 commit comments

Comments
 (0)