diff --git a/_pytest/config.py b/_pytest/config.py index a07174d72..d70ea4507 100644 --- a/_pytest/config.py +++ b/_pytest/config.py @@ -102,7 +102,7 @@ def directory_arg(path, optname): _preinit = [] default_plugins = ( - "mark main terminal runner python fixtures debugging unittest capture skipping " + "mark main terminal runner python fixtures debugging unittest capture skipping " "tmpdir monkeypatch recwarn pastebin helpconfig nose assertion " "junitxml resultlog doctest cacheprovider freeze_support " "setuponly setupplan warnings").split() @@ -161,7 +161,7 @@ def _prepareconfig(args=None, plugins=None): if warning: config.warn('C1', warning) return pluginmanager.hook.pytest_cmdline_parse( - pluginmanager=pluginmanager, args=args) + pluginmanager=pluginmanager, args=args) except BaseException: config._ensure_unconfigure() raise @@ -235,7 +235,7 @@ class PytestPluginManager(PluginManager): def parse_hookspec_opts(self, module_or_class, name): opts = super(PytestPluginManager, self).parse_hookspec_opts( - module_or_class, name) + module_or_class, name) if opts is None: method = getattr(module_or_class, name) if name.startswith("pytest_"): @@ -258,7 +258,7 @@ class PytestPluginManager(PluginManager): ret = super(PytestPluginManager, self).register(plugin, name) if ret: self.hook.pytest_plugin_registered.call_historic( - kwargs=dict(plugin=plugin, manager=self)) + kwargs=dict(plugin=plugin, manager=self)) if isinstance(plugin, types.ModuleType): self.consider_module(plugin) @@ -1099,10 +1099,10 @@ class Config(object): def parse(self, args, addopts=True): # parse given cmdline arguments into this config object. assert not hasattr(self, 'args'), ( - "can only parse cmdline args at most once per Config object") + "can only parse cmdline args at most once per Config object") self._origargs = args self.hook.pytest_addhooks.call_historic( - kwargs=dict(pluginmanager=self.pluginmanager)) + kwargs=dict(pluginmanager=self.pluginmanager)) self._preparse(args, addopts=addopts) # XXX deprecated hook: self.hook.pytest_cmdline_preparse(config=self, args=args) diff --git a/_pytest/deprecated.py b/_pytest/deprecated.py index e75ff099e..a2218b8c0 100644 --- a/_pytest/deprecated.py +++ b/_pytest/deprecated.py @@ -8,7 +8,7 @@ be removed when the time comes. from __future__ import absolute_import, division, print_function MAIN_STR_ARGS = 'passing a string to pytest.main() is deprecated, ' \ - 'pass a list of arguments instead.' + 'pass a list of arguments instead.' YIELD_TESTS = 'yield tests are deprecated, and scheduled to be removed in pytest 4.0' diff --git a/_pytest/fixtures.py b/_pytest/fixtures.py index 61069664e..44c4397e6 100644 --- a/_pytest/fixtures.py +++ b/_pytest/fixtures.py @@ -172,9 +172,9 @@ def reorder_items_atscope(items, ignore, argkeys_cache, scopenum): items_done = [] while 1: items_before, items_same, items_other, newignore = \ - slice_items(items, ignore, argkeys_cache[scopenum]) + slice_items(items, ignore, argkeys_cache[scopenum]) items_before = reorder_items_atscope( - items_before, ignore, argkeys_cache,scopenum+1) + items_before, ignore, argkeys_cache,scopenum+1) if items_same is None: # nothing to reorder in this scope assert items_other is None @@ -826,7 +826,7 @@ class FixtureFunctionMarker: def __call__(self, function): if isclass(function): raise ValueError( - "class fixtures not supported (may be in the future)") + "class fixtures not supported (may be in the future)") function._pytestfixturefunction = self return function @@ -873,7 +873,7 @@ def fixture(scope="function", params=None, autouse=False, ids=None, name=None): if callable(scope) and params is None and autouse == False: # direct decoration return FixtureFunctionMarker( - "function", params, autouse, name=name)(scope) + "function", params, autouse, name=name)(scope) if params is not None and not isinstance(params, (list, tuple)): params = list(params) return FixtureFunctionMarker(scope, params, autouse, ids=ids, name=name) @@ -888,7 +888,7 @@ def yield_fixture(scope="function", params=None, autouse=False, ids=None, name=N if callable(scope) and params is None and not autouse: # direct decoration return FixtureFunctionMarker( - "function", params, autouse, ids=ids, name=name)(scope) + "function", params, autouse, ids=ids, name=name)(scope) else: return FixtureFunctionMarker(scope, params, autouse, ids=ids, name=name) diff --git a/_pytest/junitxml.py b/_pytest/junitxml.py index 301633706..9d098051c 100644 --- a/_pytest/junitxml.py +++ b/_pytest/junitxml.py @@ -444,9 +444,9 @@ class LogXML(object): """ if self.global_properties: return Junit.properties( - [ - Junit.property(name=name, value=value) - for name, value in self.global_properties - ] + [ + Junit.property(name=name, value=value) + for name, value in self.global_properties + ] ) return '' diff --git a/_pytest/monkeypatch.py b/_pytest/monkeypatch.py index a70b23dda..39ac77013 100644 --- a/_pytest/monkeypatch.py +++ b/_pytest/monkeypatch.py @@ -71,9 +71,9 @@ def annotated_getattr(obj, name, ann): obj = getattr(obj, name) except AttributeError: raise AttributeError( - '%r object at %s has no attribute %r' % ( - type(obj).__name__, ann, name - ) + '%r object at %s has no attribute %r' % ( + type(obj).__name__, ann, name + ) ) return obj diff --git a/_pytest/pytester.py b/_pytest/pytester.py index 9b124f57e..9a0264585 100644 --- a/_pytest/pytester.py +++ b/_pytest/pytester.py @@ -30,7 +30,7 @@ def pytest_addoption(parser): parser.addoption('--runpytest', default="inprocess", dest="runpytest", choices=("inprocess", "subprocess", ), - help=("run pytest sub runs in tests using an 'inprocess' " + help=("run pytest sub runs in tests using an 'inprocess' " "or 'subprocess' (python -m main) method")) @@ -1036,7 +1036,7 @@ def getdecoded(out): return out.decode("utf-8") except UnicodeDecodeError: return "INTERNAL not-utf8-decodeable, truncated string:\n%s" % ( - py.io.saferepr(out),) + py.io.saferepr(out),) class LineComp: diff --git a/_pytest/python.py b/_pytest/python.py index 27b81247e..0f49a07f9 100644 --- a/_pytest/python.py +++ b/_pytest/python.py @@ -792,7 +792,7 @@ class Metafunc(fixtures.FuncargnamesCompatAttr): if not parameters: fs, lineno = getfslineno(self.function) reason = "got empty parameter set %r, function %s at %s:%d" % ( - argnames, self.function.__name__, fs, lineno) + argnames, self.function.__name__, fs, lineno) mark = MARK_GEN.skip(reason=reason) parameters.append(ParameterSet( values=(NOTSET,) * len(argnames), @@ -813,7 +813,7 @@ class Metafunc(fixtures.FuncargnamesCompatAttr): name = 'fixture' if indirect else 'argument' raise ValueError( "%r uses no %s %r" % ( - self.function, name, arg)) + self.function, name, arg)) if indirect is True: valtypes = dict.fromkeys(argnames, "params") diff --git a/_pytest/runner.py b/_pytest/runner.py index 5f4093b1d..e15a53757 100644 --- a/_pytest/runner.py +++ b/_pytest/runner.py @@ -135,9 +135,9 @@ def call_and_report(item, when, log=True, **kwds): def check_interactive_exception(call, report): return call.excinfo and not ( - hasattr(report, "wasxfail") or - call.excinfo.errisinstance(skip.Exception) or - call.excinfo.errisinstance(bdb.BdbQuit)) + hasattr(report, "wasxfail") or + call.excinfo.errisinstance(skip.Exception) or + call.excinfo.errisinstance(bdb.BdbQuit)) def call_runtest_hook(item, when, **kwds): hookname = "pytest_runtest_" + when @@ -365,7 +365,7 @@ class CollectReport(BaseReport): def __repr__(self): return "" % ( - self.nodeid, len(self.result), self.outcome) + self.nodeid, len(self.result), self.outcome) class CollectErrorRepr(TerminalRepr): def __init__(self, msg): diff --git a/testing/code/test_source.py b/testing/code/test_source.py index e456da409..6a9b458ec 100644 --- a/testing/code/test_source.py +++ b/testing/code/test_source.py @@ -537,7 +537,7 @@ def test_comment_in_statement(): ''' for line in range(1,3): assert str(getstatement(line, source)) == \ - 'test(foo=1,\n # comment 1\n bar=2)' + 'test(foo=1,\n # comment 1\n bar=2)' def test_single_line_else(): source = getstatement(1, "if False: 2\nelse: 3") diff --git a/testing/python/approx.py b/testing/python/approx.py index 3fac456ff..6338441ae 100644 --- a/testing/python/approx.py +++ b/testing/python/approx.py @@ -43,7 +43,7 @@ class TestApprox(object): def test_exactly_equal(self): examples = [ - (2.0, 2.0), + (2.0, 2.0), (0.1e200, 0.1e200), (1.123e-300, 1.123e-300), (12345, 12345.0), @@ -57,7 +57,7 @@ class TestApprox(object): def test_opposite_sign(self): examples = [ - (eq, 1e-100, -1e-100), + (eq, 1e-100, -1e-100), (ne, 1e100, -1e100), ] for op, a, x in examples: @@ -65,7 +65,7 @@ class TestApprox(object): def test_zero_tolerance(self): within_1e10 = [ - (1.1e-100, 1e-100), + (1.1e-100, 1e-100), (-1.1e-100, -1e-100), ] for a, x in within_1e10: @@ -79,11 +79,11 @@ class TestApprox(object): def test_negative_tolerance(self): # Negative tolerances are not allowed. illegal_kwargs = [ - dict(rel=-1e100), - dict(abs=-1e100), - dict(rel=1e100, abs=-1e100), - dict(rel=-1e100, abs=1e100), - dict(rel=-1e100, abs=-1e100), + dict(rel=-1e100), + dict(abs=-1e100), + dict(rel=1e100, abs=-1e100), + dict(rel=-1e100, abs=1e100), + dict(rel=-1e100, abs=-1e100), ] for kwargs in illegal_kwargs: with pytest.raises(ValueError): @@ -92,7 +92,7 @@ class TestApprox(object): def test_inf_tolerance(self): # Everything should be equal if the tolerance is infinite. large_diffs = [ - (1, 1000), + (1, 1000), (1e-50, 1e50), (-1.0, -1e300), (0.0, 10), @@ -107,8 +107,8 @@ class TestApprox(object): # If the relative tolerance is zero but the expected value is infinite, # the actual tolerance is a NaN, which should be an error. illegal_kwargs = [ - dict(rel=inf, abs=0.0), - dict(rel=inf, abs=inf), + dict(rel=inf, abs=0.0), + dict(rel=inf, abs=inf), ] for kwargs in illegal_kwargs: with pytest.raises(ValueError): @@ -116,9 +116,9 @@ class TestApprox(object): def test_nan_tolerance(self): illegal_kwargs = [ - dict(rel=nan), - dict(abs=nan), - dict(rel=nan, abs=nan), + dict(rel=nan), + dict(abs=nan), + dict(rel=nan, abs=nan), ] for kwargs in illegal_kwargs: with pytest.raises(ValueError): @@ -135,7 +135,7 @@ class TestApprox(object): # None of the other tests (except the doctests) should be affected by # the choice of defaults. examples = [ - # Relative tolerance used. + # Relative tolerance used. (eq, 1e100 + 1e94, 1e100), (ne, 1e100 + 2e94, 1e100), (eq, 1e0 + 1e-6, 1e0), @@ -166,7 +166,7 @@ class TestApprox(object): def test_relative_tolerance(self): within_1e8_rel = [ - (1e8 + 1e0, 1e8), + (1e8 + 1e0, 1e8), (1e0 + 1e-8, 1e0), (1e-8 + 1e-16, 1e-8), ] @@ -176,7 +176,7 @@ class TestApprox(object): def test_absolute_tolerance(self): within_1e8_abs = [ - (1e8 + 9e-9, 1e8), + (1e8 + 9e-9, 1e8), (1e0 + 9e-9, 1e0), (1e-8 + 9e-9, 1e-8), ] @@ -201,7 +201,7 @@ class TestApprox(object): def test_expecting_inf(self): examples = [ - (eq, inf, inf), + (eq, inf, inf), (eq, -inf, -inf), (ne, inf, -inf), (ne, 0.0, inf), @@ -212,7 +212,7 @@ class TestApprox(object): def test_expecting_nan(self): examples = [ - (nan, nan), + (nan, nan), (-nan, -nan), (nan, -nan), (0.0, nan), @@ -230,7 +230,7 @@ class TestApprox(object): def test_expecting_sequence(self): within_1e8 = [ - (1e8 + 1e0, 1e8), + (1e8 + 1e0, 1e8), (1e0 + 1e-8, 1e0), (1e-8 + 1e-16, 1e-8), ] @@ -243,7 +243,7 @@ class TestApprox(object): def test_complex(self): within_1e6 = [ - ( 1.000001 + 1.0j, 1.0 + 1.0j), + ( 1.000001 + 1.0j, 1.0 + 1.0j), (1.0 + 1.000001j, 1.0 + 1.0j), (-1.000001 + 1.0j, -1.0 + 1.0j), (1.0 - 1.000001j, 1.0 - 1.0j), @@ -254,7 +254,7 @@ class TestApprox(object): def test_int(self): within_1e6 = [ - (1000001, 1000000), + (1000001, 1000000), (-1000001, -1000000), ] for a, x in within_1e6: @@ -263,7 +263,7 @@ class TestApprox(object): def test_decimal(self): within_1e6 = [ - (Decimal('1.000001'), Decimal('1.0')), + (Decimal('1.000001'), Decimal('1.0')), (Decimal('-1.000001'), Decimal('-1.0')), ] for a, x in within_1e6: @@ -272,7 +272,7 @@ class TestApprox(object): def test_fraction(self): within_1e6 = [ - (1 + Fraction(1, 1000000), Fraction(1)), + (1 + Fraction(1, 1000000), Fraction(1)), (-1 - Fraction(-1, 1000000), Fraction(-1)), ] for a, x in within_1e6: @@ -282,10 +282,10 @@ class TestApprox(object): def test_doctests(self): parser = doctest.DocTestParser() test = parser.get_doctest( - approx.__doc__, - {'approx': approx}, - approx.__name__, - None, None, + approx.__doc__, + {'approx': approx}, + approx.__name__, + None, None, ) runner = MyDocTestRunner() runner.run(test) diff --git a/testing/test_assertion.py b/testing/test_assertion.py index c385f6aa1..cf31f3d92 100644 --- a/testing/test_assertion.py +++ b/testing/test_assertion.py @@ -772,7 +772,7 @@ def test_assertrepr_loaded_per_dir(testdir): b_conftest.write('def pytest_assertrepr_compare(): return ["summary b"]') result = testdir.runpytest() result.stdout.fnmatch_lines([ - '*def test_base():*', + '*def test_base():*', '*E*assert 1 == 2*', '*def test_a():*', '*E*assert summary a*', diff --git a/testing/test_mark.py b/testing/test_mark.py index 0792b04fd..25ca7f0f1 100644 --- a/testing/test_mark.py +++ b/testing/test_mark.py @@ -200,7 +200,7 @@ def test_strict_prohibits_unregistered_markers(testdir): ]) @pytest.mark.parametrize("spec", [ - ("xyz", ("test_one",)), + ("xyz", ("test_one",)), ("xyz and xyz2", ()), ("xyz2", ("test_two",)), ("xyz or xyz2", ("test_one", "test_two"),) @@ -223,7 +223,7 @@ def test_mark_option(spec, testdir): assert list(passed) == list(passed_result) @pytest.mark.parametrize("spec", [ - ("interface", ("test_interface",)), + ("interface", ("test_interface",)), ("not interface", ("test_nointer",)), ]) def test_mark_option_custom(spec, testdir): @@ -248,7 +248,7 @@ def test_mark_option_custom(spec, testdir): assert list(passed) == list(passed_result) @pytest.mark.parametrize("spec", [ - ("interface", ("test_interface",)), + ("interface", ("test_interface",)), ("not interface", ("test_nointer", "test_pass")), ("pass", ("test_pass",)), ("not pass", ("test_interface", "test_nointer")), @@ -271,7 +271,7 @@ def test_keyword_option_custom(spec, testdir): @pytest.mark.parametrize("spec", [ - ("None", ("test_func[None]",)), + ("None", ("test_func[None]",)), ("1.3", ("test_func[1.3]",)), ("2-3", ("test_func[2-3]",)) ]) diff --git a/testing/test_pluginmanager.py b/testing/test_pluginmanager.py index 1f0f4f602..d6cdfdb1f 100644 --- a/testing/test_pluginmanager.py +++ b/testing/test_pluginmanager.py @@ -29,7 +29,7 @@ class TestPytestPluginInteractions(object): config = get_config() pm = config.pluginmanager pm.hook.pytest_addhooks.call_historic( - kwargs=dict(pluginmanager=config.pluginmanager)) + kwargs=dict(pluginmanager=config.pluginmanager)) config.pluginmanager._importconftest(conf) #print(config.pluginmanager.get_plugins()) res = config.hook.pytest_myhook(xyz=10) diff --git a/testing/test_resultlog.py b/testing/test_resultlog.py index fd167c36b..31df4dd39 100644 --- a/testing/test_resultlog.py +++ b/testing/test_resultlog.py @@ -6,7 +6,7 @@ import py import pytest from _pytest.main import Node, Item, FSCollector from _pytest.resultlog import generic_path, ResultLog, \ - pytest_configure, pytest_unconfigure + pytest_configure, pytest_unconfigure def test_generic_path(testdir): diff --git a/tox.ini b/tox.ini index 31957cfb1..f2c82ad18 100644 --- a/tox.ini +++ b/tox.ini @@ -196,6 +196,6 @@ filterwarnings = ignore:.*inspect.getargspec.*deprecated, use inspect.signature.*:DeprecationWarning [flake8] -ignore = 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 = 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