Skip to content

Commit 9bf3efb

Browse files
authored
Merge pull request #7120 from bluetech/update-dev
pre-commit: update some tool revisions
2 parents 9828cfa + 3cd97d5 commit 9bf3efb

File tree

8 files changed

+19
-17
lines changed

8 files changed

+19
-17
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ repos:
55
- id: black
66
args: [--safe, --quiet]
77
- repo: https://github.com/asottile/blacken-docs
8-
rev: v1.0.0
8+
rev: v1.6.0
99
hooks:
1010
- id: blacken-docs
1111
additional_dependencies: [black==19.10b0]
1212
- repo: https://github.com/pre-commit/pre-commit-hooks
13-
rev: v2.2.3
13+
rev: v2.5.0
1414
hooks:
1515
- id: trailing-whitespace
1616
- id: end-of-file-fixer
@@ -32,7 +32,7 @@ repos:
3232
- id: reorder-python-imports
3333
args: ['--application-directories=.:src', --py3-plus]
3434
- repo: https://github.com/asottile/pyupgrade
35-
rev: v1.18.0
35+
rev: v2.2.1
3636
hooks:
3737
- id: pyupgrade
3838
args: [--py3-plus]

src/_pytest/capture.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ def __init__(self, targetfd, tmpfile=None):
505505
self.done = self._done
506506
if targetfd == 0:
507507
assert not tmpfile, "cannot set tmpfile with stdin"
508-
tmpfile = open(os.devnull, "r")
508+
tmpfile = open(os.devnull)
509509
self.syscapture = SysCapture(targetfd)
510510
else:
511511
if tmpfile is None:
@@ -580,7 +580,7 @@ class FDCapture(FDCaptureBinary):
580580
"""
581581

582582
# Ignore type because it doesn't match the type in the superclass (bytes).
583-
EMPTY_BUFFER = str() # type: ignore
583+
EMPTY_BUFFER = "" # type: ignore
584584

585585
def snap(self):
586586
self.tmpfile.seek(0)
@@ -651,7 +651,7 @@ def writeorg(self, data):
651651

652652

653653
class SysCapture(SysCaptureBinary):
654-
EMPTY_BUFFER = str() # type: ignore[assignment] # noqa: F821
654+
EMPTY_BUFFER = "" # type: ignore[assignment] # noqa: F821
655655

656656
def snap(self):
657657
res = self.tmpfile.getvalue()

src/_pytest/mark/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ def param(*values, **kw):
2727
2828
.. code-block:: python
2929
30-
@pytest.mark.parametrize("test_input,expected", [
31-
("3+5", 8),
32-
pytest.param("6*9", 42, marks=pytest.mark.xfail),
33-
])
30+
@pytest.mark.parametrize(
31+
"test_input,expected",
32+
[("3+5", 8), pytest.param("6*9", 42, marks=pytest.mark.xfail),],
33+
)
3434
def test_eval(test_input, expected):
3535
assert eval(test_input) == expected
3636

src/_pytest/monkeypatch.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ def context(self) -> Generator["MonkeyPatch", None, None]:
117117
.. code-block:: python
118118
119119
import functools
120+
121+
120122
def test_partial(monkeypatch):
121123
with monkeypatch.context() as m:
122124
m.setattr(functools, "partial", 3)

src/_pytest/pytester.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,8 +1202,8 @@ def handle_timeout():
12021202
finally:
12031203
f1.close()
12041204
f2.close()
1205-
f1 = open(str(p1), "r", encoding="utf8")
1206-
f2 = open(str(p2), "r", encoding="utf8")
1205+
f1 = open(str(p1), encoding="utf8")
1206+
f2 = open(str(p2), encoding="utf8")
12071207
try:
12081208
out = f1.read().splitlines()
12091209
err = f2.read().splitlines()

testing/acceptance_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,7 @@ def test_simple():
13391339
result.stderr.fnmatch_lines(["*@this is stderr@*"])
13401340

13411341
# now ensure the output is in the junitxml
1342-
with open(os.path.join(testdir.tmpdir.strpath, "output.xml"), "r") as f:
1342+
with open(os.path.join(testdir.tmpdir.strpath, "output.xml")) as f:
13431343
fullXml = f.read()
13441344
assert "@this is stdout@\n" in fullXml
13451345
assert "@this is stderr@\n" in fullXml

testing/logging/test_reporting.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,11 +1103,11 @@ def test_second():
11031103
"""
11041104
)
11051105
testdir.runpytest()
1106-
with open(os.path.join(report_dir_base, "test_first"), "r") as rfh:
1106+
with open(os.path.join(report_dir_base, "test_first")) as rfh:
11071107
content = rfh.read()
11081108
assert "message from test 1" in content
11091109

1110-
with open(os.path.join(report_dir_base, "test_second"), "r") as rfh:
1110+
with open(os.path.join(report_dir_base, "test_second")) as rfh:
11111111
content = rfh.read()
11121112
assert "message from test 2" in content
11131113

testing/test_capture.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,14 +1401,14 @@ def test_global(fix1):
14011401
result = testdir.runpytest_subprocess("--log-cli-level=INFO")
14021402
assert result.ret == 0
14031403

1404-
with open("caplog", "r") as f:
1404+
with open("caplog") as f:
14051405
caplog = f.read()
14061406

14071407
assert "fix setup" in caplog
14081408
assert "something in test" in caplog
14091409
assert "fix teardown" in caplog
14101410

1411-
with open("capstdout", "r") as f:
1411+
with open("capstdout") as f:
14121412
capstdout = f.read()
14131413

14141414
assert "fix setup" in capstdout

0 commit comments

Comments
 (0)