Skip to content

Commit

Permalink
Merge 65545d8 into 6660966
Browse files Browse the repository at this point in the history
  • Loading branch information
asottile committed Oct 8, 2018
2 parents 6660966 + 65545d8 commit 2a6c1dc
Show file tree
Hide file tree
Showing 18 changed files with 29 additions and 35 deletions.
15 changes: 8 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions bench/bench_argcomplete.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


# 10000 iterations, just for relative comparison
# 2.7.5 3.3.2
# FilesCompleter 75.1109 69.2116
Expand Down
1 change: 0 additions & 1 deletion bench/manyparam.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import pytest


Expand Down
6 changes: 3 additions & 3 deletions doc/en/example/assertion/failure_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,9 @@ class A(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):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

hello = "world"


Expand Down
1 change: 0 additions & 1 deletion doc/en/example/assertion/test_failures.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import py

failure_demo = py.path.local(__file__).dirpath("failure_demo.py")
Expand Down
1 change: 0 additions & 1 deletion doc/en/example/costlysetup/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import pytest


Expand Down
1 change: 0 additions & 1 deletion src/_pytest/_argcomplete.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/_pytest/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ def _importconftest(self, conftestpath):
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(
Expand Down
2 changes: 1 addition & 1 deletion src/_pytest/junitxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
3 changes: 2 additions & 1 deletion src/_pytest/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion src/_pytest/mark/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ def _istrue(self):
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:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import pytest


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import pytest


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import pytest


Expand Down
1 change: 0 additions & 1 deletion testing/example_scripts/issue_519.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import pytest
import pprint

Expand Down
18 changes: 9 additions & 9 deletions testing/python/approx.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ def test_repr_string(self, plus_minus):
@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):
Expand Down Expand Up @@ -354,16 +354,16 @@ def test_numpy_tolerance_args(self):
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:
Expand Down
2 changes: 1 addition & 1 deletion testing/test_pytester.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 2a6c1dc

Please sign in to comment.