diff --git a/_pytest/_code/source.py b/_pytest/_code/source.py index 8b5268533..b17d15659 100644 --- a/_pytest/_code/source.py +++ b/_pytest/_code/source.py @@ -165,7 +165,7 @@ class Source(object): if not filename or py.path.local(filename).check(file=0): if _genframe is None: _genframe = sys._getframe(1) # the caller - fn,lineno = _genframe.f_code.co_filename, _genframe.f_lineno + fn, lineno = _genframe.f_code.co_filename, _genframe.f_lineno base = "<%d-codegen " % self._compilecounter self.__class__._compilecounter += 1 if not filename: @@ -337,7 +337,7 @@ def get_statement_startend2(lineno, node): def getstatementrange_ast(lineno, source, assertion=False, astnode=None): if astnode is None: content = str(source) - if sys.version_info < (2,7): + if sys.version_info < (2, 7): content += "\n" try: astnode = compile(content, "source", "exec", 1024) # 1024 for AST diff --git a/_pytest/assertion/rewrite.py b/_pytest/assertion/rewrite.py index 2ffa3c03e..1ae41bd14 100644 --- a/_pytest/assertion/rewrite.py +++ b/_pytest/assertion/rewrite.py @@ -36,10 +36,10 @@ PYC_TAIL = "." + PYTEST_TAG + PYC_EXT REWRITE_NEWLINES = sys.version_info[:2] != (2, 7) and sys.version_info < (3, 2) ASCII_IS_DEFAULT_ENCODING = sys.version_info[0] < 3 -if sys.version_info >= (3,5): +if sys.version_info >= (3, 5): ast_Call = ast.Call else: - ast_Call = lambda a,b,c: ast.Call(a, b, c, None, None) + ast_Call = lambda a, b, c: ast.Call(a, b, c, None, None) class AssertionRewritingHook(object): diff --git a/_pytest/capture.py b/_pytest/capture.py index 3661f2691..1231ae825 100644 --- a/_pytest/capture.py +++ b/_pytest/capture.py @@ -463,7 +463,7 @@ class DontReadFromInput: @property def buffer(self): - if sys.version_info >= (3,0): + if sys.version_info >= (3, 0): return self else: raise AttributeError('redirected stdin has no attribute buffer') diff --git a/_pytest/config.py b/_pytest/config.py index 9e6a92e18..68da9c342 100644 --- a/_pytest/config.py +++ b/_pytest/config.py @@ -392,7 +392,7 @@ class PytestPluginManager(PluginManager): # def consider_preparse(self, args): - for opt1,opt2 in zip(args, args[1:]): + for opt1, opt2 in zip(args, args[1:]): if opt1 == "-p": self.consider_pluginarg(opt2) diff --git a/_pytest/fixtures.py b/_pytest/fixtures.py index f489a87e2..12d7bbb83 100644 --- a/_pytest/fixtures.py +++ b/_pytest/fixtures.py @@ -174,7 +174,7 @@ def reorder_items_atscope(items, ignore, argkeys_cache, scopenum): items_before, items_same, items_other, newignore = \ 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 diff --git a/_pytest/helpconfig.py b/_pytest/helpconfig.py index 72484fda5..d5fee5d54 100644 --- a/_pytest/helpconfig.py +++ b/_pytest/helpconfig.py @@ -161,7 +161,7 @@ def pytest_report_header(config): lines = [] if config.option.debug or config.option.traceconfig: lines.append("using: pytest-%s pylib-%s" % - (pytest.__version__,py.__version__)) + (pytest.__version__, py.__version__)) verinfo = getpluginversioninfo(config) if verinfo: diff --git a/_pytest/python.py b/_pytest/python.py index b12cc926f..f63d6bbc4 100644 --- a/_pytest/python.py +++ b/_pytest/python.py @@ -76,9 +76,9 @@ def pytest_addoption(parser): parser.addini("python_files", type="args", default=['test_*.py', '*_test.py'], help="glob-style file patterns for Python test module discovery") - parser.addini("python_classes", type="args", default=["Test",], + parser.addini("python_classes", type="args", default=["Test", ], help="prefixes or glob names for Python test class discovery") - parser.addini("python_functions", type="args", default=["test",], + parser.addini("python_functions", type="args", default=["test", ], help="prefixes or glob names for Python test function and " "method discovery") @@ -357,7 +357,7 @@ class PyCollector(PyobjMixin, main.Collector): yield Function(name=subname, parent=self, callspec=callspec, callobj=funcobj, fixtureinfo=fixtureinfo, - keywords={callspec.id:True}, + keywords={callspec.id: True}, originalname=name, ) @@ -687,7 +687,7 @@ class CallSpec2(object): def setmulti(self, valtypes, argnames, valset, id, keywords, scopenum, param_index): - for arg,val in zip(argnames, valset): + for arg, val in zip(argnames, valset): self._checkargnotcontained(arg) valtype_for_arg = valtypes[arg] getattr(self, valtype_for_arg)[arg] = val diff --git a/_pytest/runner.py b/_pytest/runner.py index 0ef3b30fb..21401e92b 100644 --- a/_pytest/runner.py +++ b/_pytest/runner.py @@ -246,7 +246,7 @@ class BaseReport(object): def pytest_runtest_makereport(item, call): when = call.when duration = call.stop - call.start - keywords = dict([(x,1) for x in item.keywords]) + keywords = dict([(x, 1) for x in item.keywords]) excinfo = call.excinfo sections = [] if not call.excinfo: diff --git a/_pytest/terminal.py b/_pytest/terminal.py index f57f6e466..55e57b97a 100644 --- a/_pytest/terminal.py +++ b/_pytest/terminal.py @@ -240,11 +240,11 @@ class TerminalReporter: word, markup = word else: if rep.passed: - markup = {'green':True} + markup = {'green': True} elif rep.failed: - markup = {'red':True} + markup = {'red': True} elif rep.skipped: - markup = {'yellow':True} + markup = {'yellow': True} line = self._locationline(rep.nodeid, *rep.location) if not hasattr(rep, 'node'): self.write_ensure_prefix(line, word, **markup) diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index b95e0cc4c..9ea200b12 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -719,12 +719,12 @@ class TestDurations(object): result = testdir.runpytest("--durations=0") assert result.ret == 0 for x in "123": - for y in 'call',: #'setup', 'call', 'teardown': + for y in 'call', : #'setup', 'call', 'teardown': for line in result.stdout.lines: if ("test_%s" % x) in line and y in line: break else: - raise AssertionError("not found %s %s" % (x,y)) + raise AssertionError("not found %s %s" % (x, y)) def test_with_deselected(self, testdir): testdir.makepyfile(self.source) diff --git a/testing/code/test_excinfo.py b/testing/code/test_excinfo.py index 96e42de16..2eb340fae 100644 --- a/testing/code/test_excinfo.py +++ b/testing/code/test_excinfo.py @@ -325,7 +325,7 @@ def test_excinfo_no_sourcecode(): except ValueError: excinfo = _pytest._code.ExceptionInfo() s = str(excinfo.traceback[-1]) - if py.std.sys.version_info < (2,5): + if py.std.sys.version_info < (2, 5): assert s == " File '':1 in ?\n ???\n" else: assert s == " File '':1 in \n ???\n" diff --git a/testing/code/test_source.py b/testing/code/test_source.py index 53703fc57..f12b8a1a1 100644 --- a/testing/code/test_source.py +++ b/testing/code/test_source.py @@ -109,7 +109,7 @@ def test_source_strip_multiline(): def test_syntaxerror_rerepresentation(): ex = pytest.raises(SyntaxError, _pytest._code.compile, 'xyz xyz') assert ex.value.lineno == 1 - assert ex.value.offset in (4,7) # XXX pypy/jython versus cpython? + assert ex.value.offset in (4, 7) # XXX pypy/jython versus cpython? assert ex.value.text.strip(), 'x x' def test_isparseable(): @@ -262,7 +262,7 @@ class TestSourceParsingAndCompiling(object): def test_getstatementrange_out_of_bounds_py3(self): source = Source("if xxx:\n from .collections import something") r = source.getstatementrange(1) - assert r == (1,2) + assert r == (1, 2) def test_getstatementrange_with_syntaxerror_issue7(self): source = Source(":") @@ -524,9 +524,9 @@ def test_comments(): comment 4 """ ''' - for line in range(2,6): + for line in range(2, 6): assert str(getstatement(line, source)) == ' x = 1' - for line in range(6,10): + for line in range(6, 10): assert str(getstatement(line, source)) == ' assert False' assert str(getstatement(10, source)) == '"""' @@ -535,7 +535,7 @@ def test_comment_in_statement(): # comment 1 bar=2) ''' - for line in range(1,3): + for line in range(1, 3): assert str(getstatement(line, source)) == \ 'test(foo=1,\n # comment 1\n bar=2)' diff --git a/testing/python/approx.py b/testing/python/approx.py index 853f2fe02..f849ede16 100644 --- a/testing/python/approx.py +++ b/testing/python/approx.py @@ -239,7 +239,7 @@ class TestApprox(object): def test_expecting_sequence_wrong_len(self): assert [1, 2] != approx([1]) - assert [1, 2] != approx([1,2,3]) + assert [1, 2] != approx([1, 2, 3]) def test_complex(self): within_1e6 = [ diff --git a/testing/python/collect.py b/testing/python/collect.py index 968e56ff5..eeae5bc16 100644 --- a/testing/python/collect.py +++ b/testing/python/collect.py @@ -421,7 +421,7 @@ class TestFunction(object): f1 = pytest.Function(name="name", parent=session, config=config, args=(1,), callobj=func1) assert f1 == f1 - f2 = pytest.Function(name="name",config=config, + f2 = pytest.Function(name="name", config=config, callobj=func2, parent=session) assert f1 != f2 @@ -733,11 +733,11 @@ class TestSorting(object): assert not (fn1 == fn3) assert fn1 != fn3 - for fn in fn1,fn2,fn3: + for fn in fn1, fn2, fn3: assert fn != 3 assert fn != modcol - assert fn != [1,2,3] - assert [1,2,3] != fn + assert fn != [1, 2, 3] + assert [1, 2, 3] != fn assert modcol != fn def test_allow_sane_sorting_for_decorators(self, testdir): diff --git a/testing/python/fixture.py b/testing/python/fixture.py index 751be095b..8d1d67959 100644 --- a/testing/python/fixture.py +++ b/testing/python/fixture.py @@ -25,7 +25,7 @@ def test_getfuncargnames(): pass assert fixtures.getfuncargnames(A().f) == ('arg1',) - if sys.version_info < (3,0): + if sys.version_info < (3, 0): assert fixtures.getfuncargnames(A.f) == ('arg1',) class TestFillFixtures(object): @@ -817,7 +817,7 @@ class TestRequestBasic(object): class TestRequestMarking(object): def test_applymarker(self, testdir): - item1,item2 = testdir.getitems(""" + item1, item2 = testdir.getitems(""" import pytest @pytest.fixture @@ -1297,7 +1297,7 @@ class TestFixtureUsages(object): reprec = testdir.inline_run("-v") reprec.assertoutcome(passed=4) l = reprec.getcalls("pytest_runtest_call")[0].item.module.l - assert l == [1,2, 10,20] + assert l == [1, 2, 10, 20] class TestFixtureManagerParseFactories(object): @@ -1706,7 +1706,7 @@ class TestAutouseManagement(object): pass """) confcut = "--confcutdir={0}".format(testdir.tmpdir) - reprec = testdir.inline_run("-v","-s", confcut) + reprec = testdir.inline_run("-v", "-s", confcut) reprec.assertoutcome(passed=8) config = reprec.getcalls("pytest_unconfigure")[0].config l = config.pluginmanager._getconftestmodules(p)[0].l @@ -1776,8 +1776,8 @@ class TestAutouseManagement(object): reprec.assertoutcome(passed=1) @pytest.mark.issue226 - @pytest.mark.parametrize("param1", ["", "params=[1]"], ids=["p00","p01"]) - @pytest.mark.parametrize("param2", ["", "params=[1]"], ids=["p10","p11"]) + @pytest.mark.parametrize("param1", ["", "params=[1]"], ids=["p00", "p01"]) + @pytest.mark.parametrize("param2", ["", "params=[1]"], ids=["p10", "p11"]) def test_ordering_dependencies_torndown_first(self, testdir, param1, param2): testdir.makepyfile(""" import pytest @@ -2108,7 +2108,7 @@ class TestFixtureMarker(object): reprec = testdir.inline_run("-v") reprec.assertoutcome(passed=4) l = reprec.getcalls("pytest_runtest_call")[0].item.module.l - assert l == [1,1,2,2] + assert l == [1, 1, 2, 2] def test_module_parametrized_ordering(self, testdir): testdir.makeconftest(""" @@ -2351,7 +2351,7 @@ class TestFixtureMarker(object): """) reprec = testdir.inline_run("-s") l = reprec.getcalls("pytest_runtest_call")[0].item.module.l - assert l == [1,2] + assert l == [1, 2] def test_parametrize_separated_lifecycle(self, testdir): testdir.makepyfile(""" @@ -2544,7 +2544,7 @@ class TestFixtureMarker(object): class TestRequestScopeAccess(object): - pytestmark = pytest.mark.parametrize(("scope", "ok", "error"),[ + pytestmark = pytest.mark.parametrize(("scope", "ok", "error"), [ ["session", "", "fspath class function module"], ["module", "module fspath", "cls function"], ["class", "module fspath cls", "function"], diff --git a/testing/python/metafunc.py b/testing/python/metafunc.py index 8718f6d52..c97dfcdcc 100644 --- a/testing/python/metafunc.py +++ b/testing/python/metafunc.py @@ -96,12 +96,12 @@ class TestMetafunc(object): def test_parametrize_error(self): def func(x, y): pass metafunc = self.Metafunc(func) - metafunc.parametrize("x", [1,2]) - pytest.raises(ValueError, lambda: metafunc.parametrize("x", [5,6])) - pytest.raises(ValueError, lambda: metafunc.parametrize("x", [5,6])) - metafunc.parametrize("y", [1,2]) - pytest.raises(ValueError, lambda: metafunc.parametrize("y", [5,6])) - pytest.raises(ValueError, lambda: metafunc.parametrize("y", [5,6])) + metafunc.parametrize("x", [1, 2]) + pytest.raises(ValueError, lambda: metafunc.parametrize("x", [5, 6])) + pytest.raises(ValueError, lambda: metafunc.parametrize("x", [5, 6])) + metafunc.parametrize("y", [1, 2]) + pytest.raises(ValueError, lambda: metafunc.parametrize("y", [5, 6])) + pytest.raises(ValueError, lambda: metafunc.parametrize("y", [5, 6])) def test_parametrize_bad_scope(self, testdir): def func(x): pass @@ -115,7 +115,7 @@ class TestMetafunc(object): def func(x, y): pass metafunc = self.Metafunc(func) - metafunc.parametrize("x", [1,2], ids=['basic', 'advanced']) + metafunc.parametrize("x", [1, 2], ids=['basic', 'advanced']) metafunc.parametrize("y", ["abc", "def"]) ids = [x.id for x in metafunc._calls] assert ids == ["basic-abc", "basic-def", "advanced-abc", "advanced-def"] @@ -133,11 +133,11 @@ class TestMetafunc(object): metafunc = self.Metafunc(func) pytest.raises(ValueError, lambda: - metafunc.parametrize("x", [1,2], ids=['basic'])) + metafunc.parametrize("x", [1, 2], ids=['basic'])) pytest.raises(ValueError, lambda: - metafunc.parametrize(("x","y"), [("abc", "def"), - ("ghi", "jkl")], ids=["one"])) + metafunc.parametrize(("x", "y"), [("abc", "def"), + ("ghi", "jkl")], ids=["one"])) @pytest.mark.issue510 def test_parametrize_empty_list(self): @@ -371,7 +371,7 @@ class TestMetafunc(object): def test_idmaker_with_ids_unique_names(self): from _pytest.python import idmaker - result = idmaker(("a"), map(pytest.param, [1,2,3,4,5]), + result = idmaker(("a"), map(pytest.param, [1, 2, 3, 4, 5]), ids=["a", "a", "b", "c", "b"]) assert result == ["a0", "a1", "b0", "c", "b1"] @@ -379,7 +379,7 @@ class TestMetafunc(object): def func(x, y): pass metafunc = self.Metafunc(func) metafunc.addcall({'x': 1}) - metafunc.parametrize('y', [2,3]) + metafunc.parametrize('y', [2, 3]) assert len(metafunc._calls) == 2 assert metafunc._calls[0].funcargs == {'x': 1, 'y': 2} assert metafunc._calls[1].funcargs == {'x': 1, 'y': 3} @@ -391,12 +391,12 @@ class TestMetafunc(object): def func(x, y): pass metafunc = self.Metafunc(func) metafunc.parametrize('x', [1], indirect=True) - metafunc.parametrize('y', [2,3], indirect=True) + metafunc.parametrize('y', [2, 3], indirect=True) assert len(metafunc._calls) == 2 assert metafunc._calls[0].funcargs == {} assert metafunc._calls[1].funcargs == {} - assert metafunc._calls[0].params == dict(x=1,y=2) - assert metafunc._calls[1].params == dict(x=1,y=3) + assert metafunc._calls[0].params == dict(x=1, y=2) + assert metafunc._calls[1].params == dict(x=1, y=3) @pytest.mark.issue714 def test_parametrize_indirect_list(self): @@ -554,12 +554,12 @@ class TestMetafunc(object): metafunc = self.Metafunc(func) metafunc.addcall(param="123") metafunc.parametrize('x', [1], indirect=True) - metafunc.parametrize('y', [2,3], indirect=True) + metafunc.parametrize('y', [2, 3], indirect=True) assert len(metafunc._calls) == 2 assert metafunc._calls[0].funcargs == {} assert metafunc._calls[1].funcargs == {} - assert metafunc._calls[0].params == dict(x=1,y=2) - assert metafunc._calls[1].params == dict(x=1,y=3) + assert metafunc._calls[0].params == dict(x=1, y=2) + assert metafunc._calls[1].params == dict(x=1, y=3) def test_parametrize_functional(self, testdir): testdir.makepyfile(""" @@ -584,7 +584,7 @@ class TestMetafunc(object): def test_parametrize_onearg(self): metafunc = self.Metafunc(lambda x: None) - metafunc.parametrize("x", [1,2]) + metafunc.parametrize("x", [1, 2]) assert len(metafunc._calls) == 2 assert metafunc._calls[0].funcargs == dict(x=1) assert metafunc._calls[0].id == "1" @@ -593,15 +593,15 @@ class TestMetafunc(object): def test_parametrize_onearg_indirect(self): metafunc = self.Metafunc(lambda x: None) - metafunc.parametrize("x", [1,2], indirect=True) + metafunc.parametrize("x", [1, 2], indirect=True) assert metafunc._calls[0].params == dict(x=1) assert metafunc._calls[0].id == "1" assert metafunc._calls[1].params == dict(x=2) assert metafunc._calls[1].id == "2" def test_parametrize_twoargs(self): - metafunc = self.Metafunc(lambda x,y: None) - metafunc.parametrize(("x", "y"), [(1,2), (3,4)]) + metafunc = self.Metafunc(lambda x, y: None) + metafunc.parametrize(("x", "y"), [(1, 2), (3, 4)]) assert len(metafunc._calls) == 2 assert metafunc._calls[0].funcargs == dict(x=1, y=2) assert metafunc._calls[0].id == "1-2" diff --git a/testing/test_argcomplete.py b/testing/test_argcomplete.py index 32705e130..0c11b1bc9 100644 --- a/testing/test_argcomplete.py +++ b/testing/test_argcomplete.py @@ -19,8 +19,8 @@ def equal_with_bash(prefix, ffc, fc, out=None): # this gives an IOError at the end of testrun def _wrapcall(*args, **kargs): try: - if py.std.sys.version_info > (2,7): - return py.std.subprocess.check_output(*args,**kargs).decode().splitlines() + if py.std.sys.version_info > (2, 7): + return py.std.subprocess.check_output(*args, **kargs).decode().splitlines() if 'stdout' in kargs: raise ValueError('stdout argument not allowed, it will be overridden.') process = py.std.subprocess.Popen( @@ -38,7 +38,7 @@ def _wrapcall(*args, **kargs): class FilesCompleter(object): 'File completer class, optionally takes a list of allowed extensions' - def __init__(self,allowednames=(),directories=True): + def __init__(self, allowednames=(), directories=True): # Fix if someone passes in a string instead of a list if type(allowednames) is str: allowednames = [allowednames] @@ -50,12 +50,12 @@ class FilesCompleter(object): completion = [] if self.allowednames: if self.directories: - files = _wrapcall(['bash','-c', + files = _wrapcall(['bash', '-c', "compgen -A directory -- '{p}'".format(p=prefix)]) completion += [f + '/' for f in files] for x in self.allowednames: completion += _wrapcall(['bash', '-c', - "compgen -A file -X '!*.{0}' -- '{p}'".format(x,p=prefix)]) + "compgen -A file -X '!*.{0}' -- '{p}'".format(x, p=prefix)]) else: completion += _wrapcall(['bash', '-c', "compgen -A file -- '{p}'".format(p=prefix)]) diff --git a/testing/test_assertion.py b/testing/test_assertion.py index 45152c00c..086006545 100644 --- a/testing/test_assertion.py +++ b/testing/test_assertion.py @@ -437,9 +437,9 @@ class TestAssert_reprcompare(object): assert len(expl) > 1 def test_list_tuples(self): - expl = callequal([], [(1,2)]) + expl = callequal([], [(1, 2)]) assert len(expl) > 1 - expl = callequal([(1,2)], []) + expl = callequal([(1, 2)], []) assert len(expl) > 1 def test_list_bad_repr(self): diff --git a/testing/test_assertrewrite.py b/testing/test_assertrewrite.py index cd16b0a68..73beaf02a 100644 --- a/testing/test_assertrewrite.py +++ b/testing/test_assertrewrite.py @@ -638,7 +638,7 @@ def test_rewritten(): testdir.tmpdir.join("test_newlines.py").write(b, "wb") assert testdir.runpytest().ret == 0 - @pytest.mark.skipif(sys.version_info < (3,3), + @pytest.mark.skipif(sys.version_info < (3, 3), reason='packages without __init__.py not supported on python 2') def test_package_without__init__py(self, testdir): pkg = testdir.mkdir('a_package_without_init_py') diff --git a/testing/test_capture.py b/testing/test_capture.py index 9ed605d25..cb9431141 100644 --- a/testing/test_capture.py +++ b/testing/test_capture.py @@ -112,7 +112,7 @@ class TestCaptureManager(object): @pytest.mark.parametrize("method", ['fd', 'sys']) def test_capturing_unicode(testdir, method): - if hasattr(sys, "pypy_version_info") and sys.pypy_version_info < (2,2): + if hasattr(sys, "pypy_version_info") and sys.pypy_version_info < (2, 2): pytest.xfail("does not work on pypy < 2.2") if sys.version_info >= (3, 0): obj = "'b\u00f6y'" diff --git a/testing/test_collection.py b/testing/test_collection.py index 834eaa300..ce5e99908 100644 --- a/testing/test_collection.py +++ b/testing/test_collection.py @@ -42,11 +42,11 @@ class TestCollector(object): assert not (fn1 == fn3) assert fn1 != fn3 - for fn in fn1,fn2,fn3: + for fn in fn1, fn2, fn3: assert fn != 3 assert fn != modcol - assert fn != [1,2,3] - assert [1,2,3] != fn + assert fn != [1, 2, 3] + assert [1, 2, 3] != fn assert modcol != fn def test_getparent(self, testdir): diff --git a/testing/test_config.py b/testing/test_config.py index 5022ac822..463c2edd7 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -666,7 +666,7 @@ class TestRootdir(object): rootdir, inifile, inicfg = determine_setup(None, args) assert rootdir == tmpdir assert inifile == inifile - rootdir, inifile, inicfg = determine_setup(None, [b,a]) + rootdir, inifile, inicfg = determine_setup(None, [b, a]) assert rootdir == tmpdir assert inifile == inifile diff --git a/testing/test_conftest.py b/testing/test_conftest.py index 3b01cc3cd..7fdddb0d5 100644 --- a/testing/test_conftest.py +++ b/testing/test_conftest.py @@ -345,7 +345,7 @@ class TestConftestVisibility(object): ]) @pytest.mark.issue616 def test_parsefactories_relative_node_ids( - self, testdir, chdir,testarg, expect_ntests_passed): + self, testdir, chdir, testarg, expect_ntests_passed): dirs = self._setup_tree(testdir) print("pytest run in cwd: %s" % ( dirs[chdir].relto(testdir.tmpdir))) diff --git a/testing/test_mark.py b/testing/test_mark.py index 309e2379c..7a437b4a3 100644 --- a/testing/test_mark.py +++ b/testing/test_mark.py @@ -8,7 +8,7 @@ from _pytest.mark import MarkGenerator as Mark, ParameterSet class TestMark(object): def test_markinfo_repr(self): from _pytest.mark import MarkInfo, Mark - m = MarkInfo(Mark("hello", (1,2), {})) + m = MarkInfo(Mark("hello", (1, 2), {})) repr(m) @pytest.mark.parametrize('attr', ['mark', 'param']) diff --git a/testing/test_parseopt.py b/testing/test_parseopt.py index 6fc46ef24..ccc951d66 100644 --- a/testing/test_parseopt.py +++ b/testing/test_parseopt.py @@ -284,7 +284,7 @@ def test_argcomplete(testdir, monkeypatch): # to handle a keyword argument env that replaces os.environ in popen or # extends the copy, advantage: could not forget to restore monkeypatch.setenv('_ARGCOMPLETE', "1") - monkeypatch.setenv('_ARGCOMPLETE_IFS',"\x0b") + monkeypatch.setenv('_ARGCOMPLETE_IFS', "\x0b") monkeypatch.setenv('COMP_WORDBREAKS', ' \\t\\n"\\\'><=;|&(:') arg = '--fu' @@ -297,12 +297,12 @@ def test_argcomplete(testdir, monkeypatch): elif not result.stdout.str(): pytest.skip("bash provided no output, argcomplete not available?") else: - if py.std.sys.version_info < (2,7): + if py.std.sys.version_info < (2, 7): result.stdout.lines = result.stdout.lines[0].split('\x0b') result.stdout.fnmatch_lines(["--funcargs", "--fulltrace"]) else: result.stdout.fnmatch_lines(["--funcargs", "--fulltrace"]) - if py.std.sys.version_info < (2,7): + if py.std.sys.version_info < (2, 7): return os.mkdir('test_argcomplete.d') arg = 'test_argc' diff --git a/testing/test_pastebin.py b/testing/test_pastebin.py index f7716f8fd..d8610ea18 100644 --- a/testing/test_pastebin.py +++ b/testing/test_pastebin.py @@ -26,7 +26,7 @@ class TestPasteCapture(object): assert len(pastebinlist) == 1 s = pastebinlist[0] assert s.find("def test_fail") != -1 - assert reprec.countoutcomes() == [1,1,1] + assert reprec.countoutcomes() == [1, 1, 1] def test_all(self, testdir, pastebinlist): from _pytest.pytester import LineMatcher @@ -40,7 +40,7 @@ class TestPasteCapture(object): pytest.skip("") """) reprec = testdir.inline_run(testpath, "--pastebin=all", '-v') - assert reprec.countoutcomes() == [1,1,1] + assert reprec.countoutcomes() == [1, 1, 1] assert len(pastebinlist) == 1 contents = pastebinlist[0].decode('utf-8') matcher = LineMatcher(contents.splitlines()) diff --git a/testing/test_runner.py b/testing/test_runner.py index 020cc2816..efaab1993 100644 --- a/testing/test_runner.py +++ b/testing/test_runner.py @@ -227,7 +227,7 @@ class BaseFunctionalTests(object): assert reps[2].when == "teardown" assert reps[2].failed assert len(reps) == 6 - for i in range(3,5): + for i in range(3, 5): assert reps[i].nodeid.endswith("test_func") assert reps[i].passed assert reps[5].when == "teardown" diff --git a/testing/test_terminal.py b/testing/test_terminal.py index 048cdc821..a03d54af4 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -872,7 +872,7 @@ def test_terminal_summary_warnings_are_displayed(testdir): ("yellow", "1 passed, 1 warnings", {"warnings": (1,), "passed": (1,)}), - ("green", "5 passed", {"passed": (1,2,3,4,5)}), + ("green", "5 passed", {"passed": (1, 2, 3, 4, 5)}), # "Boring" statuses. These have no effect on the color of the summary @@ -901,13 +901,13 @@ def test_terminal_summary_warnings_are_displayed(testdir): # A couple more complex combinations ("red", "1 failed, 2 passed, 3 xfailed", - {"passed": (1,2), "failed": (1,), "xfailed": (1,2,3)}), + {"passed": (1, 2), "failed": (1,), "xfailed": (1, 2, 3)}), ("green", "1 passed, 2 skipped, 3 deselected, 2 xfailed", {"passed": (1,), - "skipped": (1,2), - "deselected": (1,2,3), - "xfailed": (1,2)}), + "skipped": (1, 2), + "deselected": (1, 2, 3), + "xfailed": (1, 2)}), ]) def test_summary_stats(exp_line, exp_color, stats_arg): print("Based on stats: %s" % stats_arg) diff --git a/tox.ini b/tox.ini index 521f19153..473ac3fd7 100644 --- a/tox.ini +++ b/tox.ini @@ -196,6 +196,6 @@ filterwarnings = ignore:.*inspect.getargspec.*deprecated, use inspect.signature.*:DeprecationWarning [flake8] -ignore = E231,E241,E251,E261,E262,E265,E271,E272,E293,E301,E302,E303,E401,E402,E501,E701,E702,E704,E712,E731 +ignore = 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