Fixed E225 flake8 errors

missing whitespace around operator
This commit is contained in:
Andras Tim 2017-07-17 01:25:08 +02:00
parent 3fabc4d219
commit 2e8caefcab
20 changed files with 57 additions and 57 deletions

View File

@ -26,7 +26,7 @@ class Code(object):
self.firstlineno = rawcode.co_firstlineno - 1 self.firstlineno = rawcode.co_firstlineno - 1
self.name = rawcode.co_name self.name = rawcode.co_name
except AttributeError: except AttributeError:
raise TypeError("not a code object: %r" %(rawcode,)) raise TypeError("not a code object: %r" % (rawcode,))
self.raw = rawcode self.raw = rawcode
def __eq__(self, other): def __eq__(self, other):
@ -168,7 +168,7 @@ class TracebackEntry(object):
return self.lineno - self.frame.code.firstlineno return self.lineno - self.frame.code.firstlineno
def __repr__(self): def __repr__(self):
return "<TracebackEntry %s:%d>" %(self.frame.code.path, self.lineno+1) return "<TracebackEntry %s:%d>" % (self.frame.code.path, self.lineno+1)
@property @property
def statement(self): def statement(self):
@ -249,7 +249,7 @@ class TracebackEntry(object):
raise raise
except: except:
line = "???" line = "???"
return " File %r:%d in %s\n %s\n" %(fn, self.lineno+1, name, line) return " File %r:%d in %s\n %s\n" % (fn, self.lineno+1, name, line)
def name(self): def name(self):
return self.frame.code.raw.co_name return self.frame.code.raw.co_name
@ -548,7 +548,7 @@ class FormattedExcinfo(object):
str_repr = self._saferepr(value) str_repr = self._saferepr(value)
#if len(str_repr) < 70 or not isinstance(value, #if len(str_repr) < 70 or not isinstance(value,
# (list, tuple, dict)): # (list, tuple, dict)):
lines.append("%-10s = %s" %(name, str_repr)) lines.append("%-10s = %s" % (name, str_repr))
#else: #else:
# self._line("%-10s =\\" % (name,)) # self._line("%-10s =\\" % (name,))
# # XXX # # XXX
@ -575,7 +575,7 @@ class FormattedExcinfo(object):
s = self.get_source(source, line_index, excinfo, short=short) s = self.get_source(source, line_index, excinfo, short=short)
lines.extend(s) lines.extend(s)
if short: if short:
message = "in %s" %(entry.name) message = "in %s" % (entry.name)
else: else:
message = excinfo and excinfo.typename or "" message = excinfo and excinfo.typename or ""
path = self._makepath(entry.path) path = self._makepath(entry.path)
@ -699,7 +699,7 @@ class TerminalRepr(object):
return io.getvalue().strip() return io.getvalue().strip()
def __repr__(self): def __repr__(self):
return "<%s instance at %0x>" %(self.__class__, id(self)) return "<%s instance at %0x>" % (self.__class__, id(self))
class ExceptionRepr(TerminalRepr): class ExceptionRepr(TerminalRepr):
@ -850,7 +850,7 @@ class ReprFuncArgs(TerminalRepr):
if self.args: if self.args:
linesofar = "" linesofar = ""
for name, value in self.args: for name, value in self.args:
ns = "%s = %s" %(name, value) ns = "%s = %s" % (name, value)
if len(ns) + len(linesofar) + 2 > tw.fullwidth: if len(ns) + len(linesofar) + 2 > tw.fullwidth:
if linesofar: if linesofar:
tw.line(linesofar) tw.line(linesofar)

View File

@ -261,7 +261,7 @@ def _write_pyc(state, co, source_stat, pyc):
fp = open(pyc, "wb") fp = open(pyc, "wb")
except IOError: except IOError:
err = sys.exc_info()[1].errno err = sys.exc_info()[1].errno
state.trace("error writing pyc file at %s: errno=%s" %(pyc, err)) state.trace("error writing pyc file at %s: errno=%s" % (pyc, err))
# we ignore any failure to write the cache file # we ignore any failure to write the cache file
# there are many reasons, permission-denied, __pycache__ being a # there are many reasons, permission-denied, __pycache__ being a
# file etc. # file etc.

View File

@ -68,7 +68,7 @@ def getlocation(function, curdir):
lineno = py.builtin._getcode(function).co_firstlineno lineno = py.builtin._getcode(function).co_firstlineno
if fn.relto(curdir): if fn.relto(curdir):
fn = fn.relto(curdir) fn = fn.relto(curdir)
return "%s:%d" %(fn, lineno+1) return "%s:%d" % (fn, lineno+1)
def num_mock_patch_args(function): def num_mock_patch_args(function):

View File

@ -60,7 +60,7 @@ def main(args=None, plugins=None):
config._ensure_unconfigure() config._ensure_unconfigure()
except UsageError as e: except UsageError as e:
for msg in e.args: for msg in e.args:
sys.stderr.write("ERROR: %s\n" %(msg,)) sys.stderr.write("ERROR: %s\n" % (msg,))
return 4 return 4
class cmdline: # compatibility namespace class cmdline: # compatibility namespace
@ -382,7 +382,7 @@ class PytestPluginManager(PluginManager):
if path and path.relto(dirpath) or path == dirpath: if path and path.relto(dirpath) or path == dirpath:
assert mod not in mods assert mod not in mods
mods.append(mod) mods.append(mod)
self.trace("loaded conftestmodule %r" %(mod)) self.trace("loaded conftestmodule %r" % (mod))
self.consider_conftest(mod) self.consider_conftest(mod)
return mod return mod
@ -446,7 +446,7 @@ class PytestPluginManager(PluginManager):
import pytest import pytest
if not hasattr(pytest, 'skip') or not isinstance(e, pytest.skip.Exception): if not hasattr(pytest, 'skip') or not isinstance(e, pytest.skip.Exception):
raise raise
self._warn("skipped plugin %r: %s" %((modname, e.msg))) self._warn("skipped plugin %r: %s" % ((modname, e.msg)))
else: else:
mod = sys.modules[importspec] mod = sys.modules[importspec]
self.register(mod, modname) self.register(mod, modname)
@ -549,7 +549,7 @@ class Parser:
a = option.attrs() a = option.attrs()
arggroup.add_argument(*n, **a) arggroup.add_argument(*n, **a)
# bash like autocompletion for dirs (appending '/') # bash like autocompletion for dirs (appending '/')
optparser.add_argument(FILE_OR_DIR, nargs='*').completer=filescompleter optparser.add_argument(FILE_OR_DIR, nargs='*').completer = filescompleter
return optparser return optparser
def parse_setoption(self, args, option, namespace=None): def parse_setoption(self, args, option, namespace=None):
@ -857,7 +857,7 @@ class CmdOptions(object):
def __init__(self, values=()): def __init__(self, values=()):
self.__dict__.update(values) self.__dict__.update(values)
def __repr__(self): def __repr__(self):
return "<CmdOptions %r>" %(self.__dict__,) return "<CmdOptions %r>" % (self.__dict__,)
def copy(self): def copy(self):
return CmdOptions(self.__dict__) return CmdOptions(self.__dict__)
@ -947,7 +947,7 @@ class Config(object):
excinfo=excinfo) excinfo=excinfo)
if not py.builtin.any(res): if not py.builtin.any(res):
for line in str(excrepr).split("\n"): for line in str(excrepr).split("\n"):
sys.stderr.write("INTERNALERROR> %s\n" %line) sys.stderr.write("INTERNALERROR> %s\n" % line)
sys.stderr.flush() sys.stderr.flush()
def cwd_relative_nodeid(self, nodeid): def cwd_relative_nodeid(self, nodeid):
@ -1092,7 +1092,7 @@ class Config(object):
myver = pytest.__version__.split(".") myver = pytest.__version__.split(".")
if myver < ver: if myver < ver:
raise pytest.UsageError( raise pytest.UsageError(
"%s:%d: requires pytest-%s, actual pytest-%s'" %( "%s:%d: requires pytest-%s, actual pytest-%s'" % (
self.inicfg.config.path, self.inicfg.lineof('minversion'), self.inicfg.config.path, self.inicfg.lineof('minversion'),
minver, pytest.__version__)) minver, pytest.__version__))
@ -1142,7 +1142,7 @@ class Config(object):
try: try:
description, type, default = self._parser._inidict[name] description, type, default = self._parser._inidict[name]
except KeyError: except KeyError:
raise ValueError("unknown configuration value: %r" %(name,)) raise ValueError("unknown configuration value: %r" % (name,))
value = self._get_override_ini_value(name) value = self._get_override_ini_value(name)
if value is None: if value is None:
try: try:
@ -1219,7 +1219,7 @@ class Config(object):
return default return default
if skip: if skip:
import pytest import pytest
pytest.skip("no %r option found" %(name,)) pytest.skip("no %r option found" % (name,))
raise ValueError("no option named %r" % (name,)) raise ValueError("no option named %r" % (name,))
def getvalue(self, name, path=None): def getvalue(self, name, path=None):

View File

@ -553,7 +553,7 @@ class FixtureRequest(FuncargnamesCompatAttr):
return node return node
def __repr__(self): def __repr__(self):
return "<FixtureRequest for %r>" %(self.node) return "<FixtureRequest for %r>" % (self.node)
class SubRequest(FixtureRequest): class SubRequest(FixtureRequest):
@ -649,7 +649,7 @@ class FixtureLookupError(LookupError):
if faclist and name not in available: if faclist and name not in available:
available.append(name) available.append(name)
msg = "fixture %r not found" % (self.argname,) msg = "fixture %r not found" % (self.argname,)
msg += "\n available fixtures: %s" %(", ".join(sorted(available)),) msg += "\n available fixtures: %s" % (", ".join(sorted(available)),)
msg += "\n use 'pytest --fixtures [testpath]' for help on them." msg += "\n use 'pytest --fixtures [testpath]' for help on them."
return FixtureLookupErrorRepr(fspath, lineno, tblines, msg, self.argname) return FixtureLookupErrorRepr(fspath, lineno, tblines, msg, self.argname)

View File

@ -69,7 +69,7 @@ def pytest_cmdline_parse():
path = os.path.abspath("pytestdebug.log") path = os.path.abspath("pytestdebug.log")
debugfile = open(path, 'w') debugfile = open(path, 'w')
debugfile.write("versions pytest-%s, py-%s, " debugfile.write("versions pytest-%s, py-%s, "
"python-%s\ncwd=%s\nargs=%s\n\n" %( "python-%s\ncwd=%s\nargs=%s\n\n" % (
pytest.__version__, py.__version__, pytest.__version__, py.__version__,
".".join(map(str, sys.version_info)), ".".join(map(str, sys.version_info)),
os.getcwd(), config._origargs)) os.getcwd(), config._origargs))
@ -117,7 +117,7 @@ def showhelp(config):
if type is None: if type is None:
type = "string" type = "string"
spec = "%s (%s)" % (name, type) spec = "%s (%s)" % (name, type)
line = " %-24s %s" %(spec, help) line = " %-24s %s" % (spec, help)
tw.line(line[:tw.fullwidth]) tw.line(line[:tw.fullwidth])
tw.line() tw.line()
@ -175,5 +175,5 @@ def pytest_report_header(config):
r = plugin.__file__ r = plugin.__file__
else: else:
r = repr(plugin) r = repr(plugin)
lines.append(" %-20s: %s" %(name, r)) lines.append(" %-20s: %s" % (name, r))
return lines return lines

View File

@ -307,8 +307,8 @@ class Node(object):
return cls return cls
def __repr__(self): def __repr__(self):
return "<%s %r>" %(self.__class__.__name__, return "<%s %r>" % (self.__class__.__name__,
getattr(self, 'name', None)) getattr(self, 'name', None))
def warn(self, code, message): def warn(self, code, message):
""" generate a warning with the given code and message for this """ generate a warning with the given code and message for this
@ -429,7 +429,7 @@ class Node(object):
return excinfo.value.formatrepr() return excinfo.value.formatrepr()
tbfilter = True tbfilter = True
if self.config.option.fulltrace: if self.config.option.fulltrace:
style="long" style = "long"
else: else:
tb = _pytest._code.Traceback([excinfo.traceback[-1]]) tb = _pytest._code.Traceback([excinfo.traceback[-1]])
self._prunetraceback(excinfo) self._prunetraceback(excinfo)

View File

@ -97,4 +97,4 @@ def pytest_terminal_summary(terminalreporter):
s = tw.stringio.getvalue() s = tw.stringio.getvalue()
assert len(s) assert len(s)
pastebinurl = create_new_paste(s) pastebinurl = create_new_paste(s)
tr.write_line("%s --> %s" %(msg, pastebinurl)) tr.write_line("%s --> %s" % (msg, pastebinurl))

View File

@ -190,7 +190,7 @@ class ParsedCall:
def __repr__(self): def __repr__(self):
d = self.__dict__.copy() d = self.__dict__.copy()
del d['_name'] del d['_name']
return "<ParsedCall %r(**%r)>" %(self._name, d) return "<ParsedCall %r(**%r)>" % (self._name, d)
class HookRecorder: class HookRecorder:
@ -283,7 +283,7 @@ class HookRecorder:
"no test reports at all!" % (inamepart,)) "no test reports at all!" % (inamepart,))
if len(l) > 1: if len(l) > 1:
raise ValueError( raise ValueError(
"found 2 or more testreports matching %r: %s" %(inamepart, l)) "found 2 or more testreports matching %r: %s" % (inamepart, l))
return l[0] return l[0]
def getfailures(self, def getfailures(self,
@ -838,7 +838,7 @@ class Testdir:
for item in items: for item in items:
if item.name == funcname: if item.name == funcname:
return item return item
assert 0, "%r item not found in module:\n%s\nitems: %s" %( assert 0, "%r item not found in module:\n%s\nitems: %s" % (
funcname, source, items) funcname, source, items)
def getitems(self, source): def getitems(self, source):

View File

@ -606,13 +606,13 @@ class Generator(FunctionMixin, PyCollector):
for i, x in enumerate(self.obj()): for i, x in enumerate(self.obj()):
name, call, args = self.getcallargs(x) name, call, args = self.getcallargs(x)
if not callable(call): if not callable(call):
raise TypeError("%r yielded non callable test %r" %(self.obj, call,)) raise TypeError("%r yielded non callable test %r" % (self.obj, call,))
if name is None: if name is None:
name = "[%d]" % i name = "[%d]" % i
else: else:
name = "['%s']" % name name = "['%s']" % name
if name in seen: if name in seen:
raise ValueError("%r generated tests with non-unique name %r" %(self, name)) raise ValueError("%r generated tests with non-unique name %r" % (self, name))
seen[name] = True seen[name] = True
l.append(self.Function(name, self, args=args, callobj=call)) l.append(self.Function(name, self, args=args, callobj=call))
self.warn('C1', deprecated.YIELD_TESTS) self.warn('C1', deprecated.YIELD_TESTS)
@ -671,7 +671,7 @@ class CallSpec2(object):
def _checkargnotcontained(self, arg): def _checkargnotcontained(self, arg):
if arg in self.params or arg in self.funcargs: if arg in self.params or arg in self.funcargs:
raise ValueError("duplicate %r" %(arg,)) raise ValueError("duplicate %r" % (arg,))
def getparam(self, name): def getparam(self, name):
try: try:
@ -1072,12 +1072,12 @@ def _showfixtures_main(config, session):
if currentmodule != module: if currentmodule != module:
if not module.startswith("_pytest."): if not module.startswith("_pytest."):
tw.line() tw.line()
tw.sep("-", "fixtures defined from %s" %(module,)) tw.sep("-", "fixtures defined from %s" % (module,))
currentmodule = module currentmodule = module
if verbose <= 0 and argname[0] == "_": if verbose <= 0 and argname[0] == "_":
continue continue
if verbose > 0: if verbose > 0:
funcargspec = "%s -- %s" %(argname, bestrel,) funcargspec = "%s -- %s" % (argname, bestrel,)
else: else:
funcargspec = argname funcargspec = argname
tw.line(funcargspec, green=True) tw.line(funcargspec, green=True)
@ -1087,7 +1087,7 @@ def _showfixtures_main(config, session):
for line in doc.strip().split("\n"): for line in doc.strip().split("\n"):
tw.line(" " + line.strip()) tw.line(" " + line.strip())
else: else:
tw.line(" %s: no docstring available" %(loc,), tw.line(" %s: no docstring available" % (loc,),
red=True) red=True)

View File

@ -268,7 +268,7 @@ def pytest_runtest_makereport(item, call):
longrepr = item._repr_failure_py(excinfo, longrepr = item._repr_failure_py(excinfo,
style=item.config.option.tbstyle) style=item.config.option.tbstyle)
for rwhen, key, content in item._report_sections: for rwhen, key, content in item._report_sections:
sections.append(("Captured %s %s" %(key, rwhen), content)) sections.append(("Captured %s %s" % (key, rwhen), content))
return TestReport(item.nodeid, item.location, return TestReport(item.nodeid, item.location,
keywords, outcome, longrepr, when, keywords, outcome, longrepr, when,
sections, duration) sections, duration)
@ -480,7 +480,7 @@ class OutcomeException(Exception):
if isinstance(val, bytes): if isinstance(val, bytes):
val = py._builtin._totext(val, errors='replace') val = py._builtin._totext(val, errors='replace')
return val return val
return "<%s instance>" %(self.__class__.__name__,) return "<%s instance>" % (self.__class__.__name__,)
__str__ = __repr__ __str__ = __repr__
class Skipped(OutcomeException): class Skipped(OutcomeException):
@ -562,7 +562,7 @@ def importorskip(modname, minversion=None):
# Do not raise chained exception here(#1485) # Do not raise chained exception here(#1485)
should_skip = True should_skip = True
if should_skip: if should_skip:
raise Skipped("could not import %r" %(modname,), allow_module_level=True) raise Skipped("could not import %r" % (modname,), allow_module_level=True)
mod = sys.modules[modname] mod = sys.modules[modname]
if minversion is None: if minversion is None:
return mod return mod
@ -575,6 +575,6 @@ def importorskip(modname, minversion=None):
"pkg_resources to parse version strings." % (modname,), "pkg_resources to parse version strings." % (modname,),
allow_module_level=True) allow_module_level=True)
if verattr is None or pv(verattr) < pv(minversion): if verattr is None or pv(verattr) < pv(minversion):
raise Skipped("module %r has __version__ %r, required is: %r" %( raise Skipped("module %r has __version__ %r, required is: %r" % (
modname, verattr, minversion), allow_module_level=True) modname, verattr, minversion), allow_module_level=True)
return mod return mod

View File

@ -131,7 +131,7 @@ class TestGeneralUsage(object):
result = testdir.runpytest(p1, p2) result = testdir.runpytest(p1, p2)
assert result.ret assert result.ret
result.stderr.fnmatch_lines([ result.stderr.fnmatch_lines([
"*ERROR: not found:*%s" %(p2.basename,) "*ERROR: not found:*%s" % (p2.basename,)
]) ])
def test_issue486_better_reporting_on_conftest_load_failure(self, testdir): def test_issue486_better_reporting_on_conftest_load_failure(self, testdir):

View File

@ -78,7 +78,7 @@ def test_source_putaround_simple():
x = 42 x = 42
else: else:
x = 23""") x = 23""")
assert str(source)=="""\ assert str(source) == """\
try: try:
raise ValueError raise ValueError
except ValueError: except ValueError:
@ -291,7 +291,7 @@ class TestSourceParsingAndCompiling(object):
def check(comp, name): def check(comp, name):
co = comp(self.source, name) co = comp(self.source, name)
if not name: if not name:
expected = "codegen %s:%d>" %(mypath, mylineno+2+2) expected = "codegen %s:%d>" % (mypath, mylineno+2+2)
else: else:
expected = "codegen %r %s:%d>" % (name, mypath, mylineno+2+2) expected = "codegen %r %s:%d>" % (name, mypath, mylineno+2+2)
fn = co.co_filename fn = co.co_filename

View File

@ -2565,7 +2565,7 @@ class TestRequestScopeAccess(object):
assert request.config assert request.config
def test_func(): def test_func():
pass pass
""" %(scope, ok.split(), error.split())) """ % (scope, ok.split(), error.split()))
reprec = testdir.inline_run("-l") reprec = testdir.inline_run("-l")
reprec.assertoutcome(passed=1) reprec.assertoutcome(passed=1)
@ -2583,7 +2583,7 @@ class TestRequestScopeAccess(object):
assert request.config assert request.config
def test_func(arg): def test_func(arg):
pass pass
""" %(scope, ok.split(), error.split())) """ % (scope, ok.split(), error.split()))
reprec = testdir.inline_run() reprec = testdir.inline_run()
reprec.assertoutcome(passed=1) reprec.assertoutcome(passed=1)

View File

@ -619,7 +619,7 @@ class TestTruncateExplanation(object):
assert len(result) == 8 + self.LINES_IN_TRUNCATION_MSG assert len(result) == 8 + self.LINES_IN_TRUNCATION_MSG
assert "Full output truncated" in result[-1] assert "Full output truncated" in result[-1]
assert "43 lines hidden" in result[-1] assert "43 lines hidden" in result[-1]
last_line_before_trunc_msg = result[- self.LINES_IN_TRUNCATION_MSG -1] last_line_before_trunc_msg = result[- self.LINES_IN_TRUNCATION_MSG - 1]
assert last_line_before_trunc_msg.endswith("...") assert last_line_before_trunc_msg.endswith("...")
def test_truncates_at_8_lines_when_first_8_lines_are_LT_max_chars(self): def test_truncates_at_8_lines_when_first_8_lines_are_LT_max_chars(self):
@ -629,7 +629,7 @@ class TestTruncateExplanation(object):
assert len(result) == 8 + self.LINES_IN_TRUNCATION_MSG assert len(result) == 8 + self.LINES_IN_TRUNCATION_MSG
assert "Full output truncated" in result[-1] assert "Full output truncated" in result[-1]
assert "93 lines hidden" in result[-1] assert "93 lines hidden" in result[-1]
last_line_before_trunc_msg = result[- self.LINES_IN_TRUNCATION_MSG -1] last_line_before_trunc_msg = result[- self.LINES_IN_TRUNCATION_MSG - 1]
assert last_line_before_trunc_msg.endswith("...") assert last_line_before_trunc_msg.endswith("...")
def test_truncates_at_8_lines_when_first_8_lines_are_EQ_max_chars(self): def test_truncates_at_8_lines_when_first_8_lines_are_EQ_max_chars(self):
@ -639,7 +639,7 @@ class TestTruncateExplanation(object):
assert len(result) == 8 + self.LINES_IN_TRUNCATION_MSG assert len(result) == 8 + self.LINES_IN_TRUNCATION_MSG
assert "Full output truncated" in result[-1] assert "Full output truncated" in result[-1]
assert "9 lines hidden" in result[-1] assert "9 lines hidden" in result[-1]
last_line_before_trunc_msg = result[- self.LINES_IN_TRUNCATION_MSG -1] last_line_before_trunc_msg = result[- self.LINES_IN_TRUNCATION_MSG - 1]
assert last_line_before_trunc_msg.endswith("...") assert last_line_before_trunc_msg.endswith("...")
def test_truncates_at_4_lines_when_first_4_lines_are_GT_max_chars(self): def test_truncates_at_4_lines_when_first_4_lines_are_GT_max_chars(self):
@ -649,7 +649,7 @@ class TestTruncateExplanation(object):
assert len(result) == 4 + self.LINES_IN_TRUNCATION_MSG assert len(result) == 4 + self.LINES_IN_TRUNCATION_MSG
assert "Full output truncated" in result[-1] assert "Full output truncated" in result[-1]
assert "7 lines hidden" in result[-1] assert "7 lines hidden" in result[-1]
last_line_before_trunc_msg = result[- self.LINES_IN_TRUNCATION_MSG -1] last_line_before_trunc_msg = result[- self.LINES_IN_TRUNCATION_MSG - 1]
assert last_line_before_trunc_msg.endswith("...") assert last_line_before_trunc_msg.endswith("...")
def test_truncates_at_1_line_when_first_line_is_GT_max_chars(self): def test_truncates_at_1_line_when_first_line_is_GT_max_chars(self):
@ -659,7 +659,7 @@ class TestTruncateExplanation(object):
assert len(result) == 1 + self.LINES_IN_TRUNCATION_MSG assert len(result) == 1 + self.LINES_IN_TRUNCATION_MSG
assert "Full output truncated" in result[-1] assert "Full output truncated" in result[-1]
assert "1000 lines hidden" in result[-1] assert "1000 lines hidden" in result[-1]
last_line_before_trunc_msg = result[- self.LINES_IN_TRUNCATION_MSG -1] last_line_before_trunc_msg = result[- self.LINES_IN_TRUNCATION_MSG - 1]
assert last_line_before_trunc_msg.endswith("...") assert last_line_before_trunc_msg.endswith("...")
def test_full_output_truncated(self, monkeypatch, testdir): def test_full_output_truncated(self, monkeypatch, testdir):

View File

@ -347,10 +347,10 @@ class TestConftestVisibility(object):
def test_parsefactories_relative_node_ids( 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) dirs = self._setup_tree(testdir)
print("pytest run in cwd: %s" %( print("pytest run in cwd: %s" % (
dirs[chdir].relto(testdir.tmpdir))) dirs[chdir].relto(testdir.tmpdir)))
print("pytestarg : %s" %(testarg)) print("pytestarg : %s" % (testarg))
print("expected pass : %s" %(expect_ntests_passed)) print("expected pass : %s" % (expect_ntests_passed))
with dirs[chdir].as_cwd(): with dirs[chdir].as_cwd():
reprec = testdir.inline_run(testarg, "-q", "--traceconfig") reprec = testdir.inline_run(testarg, "-q", "--traceconfig")
reprec.assertoutcome(passed=expect_ntests_passed) reprec.assertoutcome(passed=expect_ntests_passed)

View File

@ -273,7 +273,7 @@ def test_argcomplete(testdir, monkeypatch):
script = str(testdir.tmpdir.join("test_argcomplete")) script = str(testdir.tmpdir.join("test_argcomplete"))
pytest_bin = sys.argv[0] pytest_bin = sys.argv[0]
if "pytest" not in os.path.basename(pytest_bin): if "pytest" not in os.path.basename(pytest_bin):
pytest.skip("need to be run with pytest executable, not %s" %(pytest_bin,)) pytest.skip("need to be run with pytest executable, not %s" % (pytest_bin,))
with open(str(script), 'w') as fp: with open(str(script), 'w') as fp:
# redirect output from argcomplete to stdin and stderr is not trivial # redirect output from argcomplete to stdin and stderr is not trivial

View File

@ -319,7 +319,7 @@ class TestPDB(object):
pytest.set_trace() pytest.set_trace()
x = 5 x = 5
""") """)
child = testdir.spawn("%s %s" %(sys.executable, p1)) child = testdir.spawn("%s %s" % (sys.executable, p1))
child.expect("x = 5") child.expect("x = 5")
child.sendeof() child.sendeof()
self.flush(child) self.flush(child)

View File

@ -80,7 +80,7 @@ class TestEvaluator(object):
%s %s
def test_func(): def test_func():
pass pass
""" % (lines[i], lines[(i+1) %2])) """ % (lines[i], lines[(i+1) % 2]))
ev = MarkEvaluator(item, 'skipif') ev = MarkEvaluator(item, 'skipif')
assert ev assert ev
assert ev.istrue() assert ev.istrue()

View File

@ -196,6 +196,6 @@ filterwarnings =
ignore:.*inspect.getargspec.*deprecated, use inspect.signature.*:DeprecationWarning ignore:.*inspect.getargspec.*deprecated, use inspect.signature.*:DeprecationWarning
[flake8] [flake8]
ignore = E225,E226,E231,E241,E251,E261,E262,E265,E271,E272,E293,E301,E302,E303,E401,E402,E501,E701,E702,E704,E712,E731 ignore = 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 max-line-length = 120
exclude = _pytest/vendored_packages/pluggy.py exclude = _pytest/vendored_packages/pluggy.py