Merge pull request #7120 from bluetech/update-dev

pre-commit: update some tool revisions
This commit is contained in:
Ran Benita 2020-04-25 23:07:15 +03:00 committed by GitHub
commit 9bf3efb8e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 19 additions and 17 deletions

View File

@ -5,12 +5,12 @@ repos:
- id: black - id: black
args: [--safe, --quiet] args: [--safe, --quiet]
- repo: https://github.com/asottile/blacken-docs - repo: https://github.com/asottile/blacken-docs
rev: v1.0.0 rev: v1.6.0
hooks: hooks:
- id: blacken-docs - id: blacken-docs
additional_dependencies: [black==19.10b0] additional_dependencies: [black==19.10b0]
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3 rev: v2.5.0
hooks: hooks:
- id: trailing-whitespace - id: trailing-whitespace
- id: end-of-file-fixer - id: end-of-file-fixer
@ -32,7 +32,7 @@ repos:
- id: reorder-python-imports - id: reorder-python-imports
args: ['--application-directories=.:src', --py3-plus] args: ['--application-directories=.:src', --py3-plus]
- repo: https://github.com/asottile/pyupgrade - repo: https://github.com/asottile/pyupgrade
rev: v1.18.0 rev: v2.2.1
hooks: hooks:
- id: pyupgrade - id: pyupgrade
args: [--py3-plus] args: [--py3-plus]

View File

@ -505,7 +505,7 @@ class FDCaptureBinary:
self.done = self._done self.done = self._done
if targetfd == 0: if targetfd == 0:
assert not tmpfile, "cannot set tmpfile with stdin" assert not tmpfile, "cannot set tmpfile with stdin"
tmpfile = open(os.devnull, "r") tmpfile = open(os.devnull)
self.syscapture = SysCapture(targetfd) self.syscapture = SysCapture(targetfd)
else: else:
if tmpfile is None: if tmpfile is None:
@ -580,7 +580,7 @@ class FDCapture(FDCaptureBinary):
""" """
# Ignore type because it doesn't match the type in the superclass (bytes). # Ignore type because it doesn't match the type in the superclass (bytes).
EMPTY_BUFFER = str() # type: ignore EMPTY_BUFFER = "" # type: ignore
def snap(self): def snap(self):
self.tmpfile.seek(0) self.tmpfile.seek(0)
@ -651,7 +651,7 @@ class SysCaptureBinary:
class SysCapture(SysCaptureBinary): class SysCapture(SysCaptureBinary):
EMPTY_BUFFER = str() # type: ignore[assignment] # noqa: F821 EMPTY_BUFFER = "" # type: ignore[assignment] # noqa: F821
def snap(self): def snap(self):
res = self.tmpfile.getvalue() res = self.tmpfile.getvalue()

View File

@ -27,10 +27,10 @@ def param(*values, **kw):
.. code-block:: python .. code-block:: python
@pytest.mark.parametrize("test_input,expected", [ @pytest.mark.parametrize(
("3+5", 8), "test_input,expected",
pytest.param("6*9", 42, marks=pytest.mark.xfail), [("3+5", 8), pytest.param("6*9", 42, marks=pytest.mark.xfail),],
]) )
def test_eval(test_input, expected): def test_eval(test_input, expected):
assert eval(test_input) == expected assert eval(test_input) == expected

View File

@ -117,6 +117,8 @@ class MonkeyPatch:
.. code-block:: python .. code-block:: python
import functools import functools
def test_partial(monkeypatch): def test_partial(monkeypatch):
with monkeypatch.context() as m: with monkeypatch.context() as m:
m.setattr(functools, "partial", 3) m.setattr(functools, "partial", 3)

View File

@ -1202,8 +1202,8 @@ class Testdir:
finally: finally:
f1.close() f1.close()
f2.close() f2.close()
f1 = open(str(p1), "r", encoding="utf8") f1 = open(str(p1), encoding="utf8")
f2 = open(str(p2), "r", encoding="utf8") f2 = open(str(p2), encoding="utf8")
try: try:
out = f1.read().splitlines() out = f1.read().splitlines()
err = f2.read().splitlines() err = f2.read().splitlines()

View File

@ -1339,7 +1339,7 @@ def test_tee_stdio_captures_and_live_prints(testdir):
result.stderr.fnmatch_lines(["*@this is stderr@*"]) result.stderr.fnmatch_lines(["*@this is stderr@*"])
# now ensure the output is in the junitxml # now ensure the output is in the junitxml
with open(os.path.join(testdir.tmpdir.strpath, "output.xml"), "r") as f: with open(os.path.join(testdir.tmpdir.strpath, "output.xml")) as f:
fullXml = f.read() fullXml = f.read()
assert "@this is stdout@\n" in fullXml assert "@this is stdout@\n" in fullXml
assert "@this is stderr@\n" in fullXml assert "@this is stderr@\n" in fullXml

View File

@ -1103,11 +1103,11 @@ def test_log_set_path(testdir):
""" """
) )
testdir.runpytest() testdir.runpytest()
with open(os.path.join(report_dir_base, "test_first"), "r") as rfh: with open(os.path.join(report_dir_base, "test_first")) as rfh:
content = rfh.read() content = rfh.read()
assert "message from test 1" in content assert "message from test 1" in content
with open(os.path.join(report_dir_base, "test_second"), "r") as rfh: with open(os.path.join(report_dir_base, "test_second")) as rfh:
content = rfh.read() content = rfh.read()
assert "message from test 2" in content assert "message from test 2" in content

View File

@ -1401,14 +1401,14 @@ def test_global_capture_with_live_logging(testdir):
result = testdir.runpytest_subprocess("--log-cli-level=INFO") result = testdir.runpytest_subprocess("--log-cli-level=INFO")
assert result.ret == 0 assert result.ret == 0
with open("caplog", "r") as f: with open("caplog") as f:
caplog = f.read() caplog = f.read()
assert "fix setup" in caplog assert "fix setup" in caplog
assert "something in test" in caplog assert "something in test" in caplog
assert "fix teardown" in caplog assert "fix teardown" in caplog
with open("capstdout", "r") as f: with open("capstdout") as f:
capstdout = f.read() capstdout = f.read()
assert "fix setup" in capstdout assert "fix setup" in capstdout