Merge pull request #4089 from asottile/upgrade_hooks

Upgrade pre-commit hooks
This commit is contained in:
Ronny Pfannschmidt 2018-10-09 07:43:28 +02:00 committed by GitHub
commit 8393fdd51d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 29 additions and 35 deletions

View File

@ -1,19 +1,19 @@
exclude: doc/en/example/py2py3/test_py2.py
repos:
- repo: https://github.com/ambv/black
rev: 18.6b4
rev: 18.9b0
hooks:
- id: black
args: [--safe, --quiet]
language_version: python3
- repo: https://github.com/asottile/blacken-docs
rev: v0.2.0
rev: v0.3.0
hooks:
- id: blacken-docs
additional_dependencies: [black==18.6b4]
additional_dependencies: [black==18.9b0]
language_version: python3
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.3.0
rev: v1.4.0-1
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
@ -22,11 +22,12 @@ repos:
exclude: _pytest/debugging.py
- id: flake8
- repo: https://github.com/asottile/pyupgrade
rev: v1.2.0
rev: v1.8.0
hooks:
- id: pyupgrade
- id: pyupgrade
args: [--keep-percent-format]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.0.0
rev: v1.1.0
hooks:
- id: rst-backticks
- repo: local

View File

@ -1,5 +1,3 @@
# 10000 iterations, just for relative comparison
# 2.7.5 3.3.2
# FilesCompleter 75.1109 69.2116

View File

@ -1,4 +1,3 @@
import pytest

View File

@ -245,9 +245,9 @@ class TestCustomAssertMsg(object):
a = 1
b = 2
assert (
A.a == b
), "A.a appears not to be b\n" "or does not appear to be b\none of those"
assert A.a == b, (
"A.a appears not to be b\n" "or does not appear to be b\none of those"
)
def test_custom_repr(self):
class JSON(object):

View File

@ -1,4 +1,3 @@
hello = "world"

View File

@ -1,4 +1,3 @@
import py
failure_demo = py.path.local(__file__).dirpath("failure_demo.py")

View File

@ -1,4 +1,3 @@
import pytest

View File

@ -1,4 +1,3 @@
"""allow bash-completion for argparse with argcomplete if installed
needs argcomplete>=0.5.6 for python 3.2/3.3 (older versions fail
to find the magic string, so _ARGCOMPLETE env. var is never set, and

View File

@ -423,7 +423,7 @@ class PytestPluginManager(PluginManager):
and not self._using_pyargs
):
from _pytest.deprecated import (
PYTEST_PLUGINS_FROM_NON_TOP_LEVEL_CONFTEST
PYTEST_PLUGINS_FROM_NON_TOP_LEVEL_CONFTEST,
)
warnings.warn_explicit(

View File

@ -38,7 +38,7 @@ class Junit(py.xml.Namespace):
# this dynamically instead of hardcoding it. The spec range of valid
# chars is: Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD]
# | [#x10000-#x10FFFF]
_legal_chars = (0x09, 0x0A, 0x0d)
_legal_chars = (0x09, 0x0A, 0x0D)
_legal_ranges = ((0x20, 0x7E), (0x80, 0xD7FF), (0xE000, 0xFFFD), (0x10000, 0x10FFFF))
_legal_xml_re = [
unicode("%s-%s") % (unichr(low), unichr(high))

View File

@ -213,7 +213,8 @@ class LogCaptureFixture(object):
def __init__(self, item):
"""Creates a new funcarg."""
self._item = item
self._initial_log_levels = {} # type: Dict[str, int] # dict of log name -> log level
# dict of log name -> log level
self._initial_log_levels = {} # type: Dict[str, int]
def _finalize(self):
"""Finalizes the fixture.

View File

@ -90,7 +90,10 @@ class MarkEvaluator(object):
else:
if "reason" not in mark.kwargs:
# XXX better be checked at collection time
msg = "you need to specify reason=STRING " "when using booleans as conditions."
msg = (
"you need to specify reason=STRING "
"when using booleans as conditions."
)
fail(msg)
result = bool(expr)
if result:

View File

@ -1,4 +1,3 @@
import pytest
import pprint

View File

@ -62,11 +62,11 @@ class TestApprox(object):
@pytest.mark.parametrize(
"value, repr_string",
[
(5., "approx(5.0 {pm} 5.0e-06)"),
([5.], "approx([5.0 {pm} 5.0e-06])"),
([[5.]], "approx([[5.0 {pm} 5.0e-06]])"),
([[5., 6.]], "approx([[5.0 {pm} 5.0e-06, 6.0 {pm} 6.0e-06]])"),
([[5.], [6.]], "approx([[5.0 {pm} 5.0e-06], [6.0 {pm} 6.0e-06]])"),
(5.0, "approx(5.0 {pm} 5.0e-06)"),
([5.0], "approx([5.0 {pm} 5.0e-06])"),
([[5.0]], "approx([[5.0 {pm} 5.0e-06]])"),
([[5.0, 6.0]], "approx([[5.0 {pm} 5.0e-06, 6.0 {pm} 6.0e-06]])"),
([[5.0], [6.0]], "approx([[5.0 {pm} 5.0e-06], [6.0 {pm} 6.0e-06]])"),
],
)
def test_repr_nd_array(self, plus_minus, value, repr_string):
@ -354,16 +354,16 @@ class TestApprox(object):
Test all permutations of where the approx and np.array() can show up
"""
np = pytest.importorskip("numpy")
expected = 100.
actual = 99.
expected = 100.0
actual = 99.0
abs_diff = expected - actual
rel_diff = (expected - actual) / expected
tests = [
(eq, abs_diff, 0),
(eq, 0, rel_diff),
(ne, 0, rel_diff / 2.), # rel diff fail
(ne, abs_diff / 2., 0), # abs diff fail
(ne, 0, rel_diff / 2.0), # rel diff fail
(ne, abs_diff / 2.0, 0), # abs diff fail
]
for op, _abs, _rel in tests:

View File

@ -176,7 +176,7 @@ def test_makepyfile_unicode(testdir):
unichr(65)
except NameError:
unichr = chr
testdir.makepyfile(unichr(0xfffd))
testdir.makepyfile(unichr(0xFFFD))
def test_makepyfile_utf8(testdir):