diff --git a/_pytest/doctest.py b/_pytest/doctest.py index fde6dd71d..cbd39652e 100644 --- a/_pytest/doctest.py +++ b/_pytest/doctest.py @@ -332,7 +332,7 @@ def _fix_spoof_python2(runner, encoding): should patch only doctests for text files because they don't have a way to declare their encoding. Doctests in docstrings from Python modules don't have the same problem given that Python already decoded the strings. - + This fixes the problem related in issue #2434. """ from _pytest.compat import _PY2 diff --git a/_pytest/pytester.py b/_pytest/pytester.py index 901caa340..768d922cf 100644 --- a/_pytest/pytester.py +++ b/_pytest/pytester.py @@ -1032,11 +1032,11 @@ class Testdir: return child def getdecoded(out): - try: - return out.decode("utf-8") - except UnicodeDecodeError: - return "INTERNAL not-utf8-decodeable, truncated string:\n%s" % ( - py.io.saferepr(out),) + try: + return out.decode("utf-8") + except UnicodeDecodeError: + return "INTERNAL not-utf8-decodeable, truncated string:\n%s" % ( + py.io.saferepr(out),) class LineComp: diff --git a/_pytest/python.py b/_pytest/python.py index 83413bbf9..1720c8762 100644 --- a/_pytest/python.py +++ b/_pytest/python.py @@ -151,7 +151,7 @@ def pytest_collect_file(path, parent): if path.fnmatch(pat): break else: - return + return ihook = parent.session.gethookproxy(path) return ihook.pytest_pycollect_makemodule(path=path, parent=parent) diff --git a/testing/test_conftest.py b/testing/test_conftest.py index b6fd7814c..ed01c5410 100644 --- a/testing/test_conftest.py +++ b/testing/test_conftest.py @@ -319,25 +319,25 @@ class TestConftestVisibility(object): # N.B.: "swc" stands for "subdir with conftest.py" # "snc" stands for "subdir no [i.e. without] conftest.py" @pytest.mark.parametrize("chdir,testarg,expect_ntests_passed", [ - # Effective target: package/.. + # Effective target: package/.. ("runner", "..", 3), ("package", "..", 3), ("swc", "../..", 3), ("snc", "../..", 3), - # Effective target: package + # Effective target: package ("runner", "../package", 3), ("package", ".", 3), ("swc", "..", 3), ("snc", "..", 3), - # Effective target: package/swc + # Effective target: package/swc ("runner", "../package/swc", 1), ("package", "./swc", 1), ("swc", ".", 1), ("snc", "../swc", 1), - # Effective target: package/snc + # Effective target: package/snc ("runner", "../package/snc", 1), ("package", "./snc", 1), ("swc", "../snc", 1), diff --git a/testing/test_doctest.py b/testing/test_doctest.py index 4a813e5c0..0aa60e8ac 100644 --- a/testing/test_doctest.py +++ b/testing/test_doctest.py @@ -535,7 +535,7 @@ class TestDoctests(object): p = testdir.makepyfile(test_unicode_doctest_module=""" # -*- encoding: utf-8 -*- from __future__ import unicode_literals - + def fix_bad_unicode(text): ''' >>> print(fix_bad_unicode('único')) diff --git a/testing/test_monkeypatch.py b/testing/test_monkeypatch.py index 1efcf7f95..789c8d1e7 100644 --- a/testing/test_monkeypatch.py +++ b/testing/test_monkeypatch.py @@ -323,6 +323,6 @@ def test_issue1338_name_resolving(): pytest.importorskip('requests') monkeypatch = MonkeyPatch() try: - monkeypatch.delattr('requests.sessions.Session.request') + monkeypatch.delattr('requests.sessions.Session.request') finally: monkeypatch.undo() diff --git a/testing/test_unittest.py b/testing/test_unittest.py index af9851997..b3a06cb5a 100644 --- a/testing/test_unittest.py +++ b/testing/test_unittest.py @@ -788,7 +788,7 @@ def test_unittest_raise_skip_issue748(testdir): def test_unittest_skip_issue1169(testdir): testdir.makepyfile(test_foo=""" import unittest - + class MyTestCase(unittest.TestCase): @unittest.skip("skipping due to reasons") def test_skip(self): diff --git a/testing/test_warnings.py b/testing/test_warnings.py index 69bda1172..213cc5370 100644 --- a/testing/test_warnings.py +++ b/testing/test_warnings.py @@ -173,9 +173,9 @@ def test_works_with_filterwarnings(testdir): class MyWarning(Warning): pass - + warnings.filterwarnings("error", category=MyWarning) - + class TestWarnings(object): def test_my_warning(self): try: diff --git a/tox.ini b/tox.ini index 100a22d45..a9f354872 100644 --- a/tox.ini +++ b/tox.ini @@ -196,6 +196,6 @@ filterwarnings = ignore:.*inspect.getargspec.*deprecated, use inspect.signature.*:DeprecationWarning [flake8] -ignore = E101,E111,E113,E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E201,E202,E203,E221,E222,E225,E226,E231,E241,E251,E261,E262,E265,E271,E272,E293,E301,E302,E303,E401,E402,E501,E701,E702,E704,E712,E731 +ignore = E111,E113,E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E201,E202,E203,E221,E222,E225,E226,E231,E241,E251,E261,E262,E265,E271,E272,E293,E301,E302,E303,E401,E402,E501,E701,E702,E704,E712,E731 max-line-length = 120 exclude = _pytest/vendored_packages/pluggy.py