Skip to content

Commit a3319ff

Browse files
Merge pull request #2071 from nicoddemus/fix-flake8
Fix flake8 E305 and E306 errors
2 parents 1e2b2af + 984d4ce commit a3319ff

39 files changed

Lines changed: 304 additions & 5 deletions

_pytest/_argcomplete.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ def __call__(self, prefix, **kwargs):
8787
completion.append(x[prefix_dir:])
8888
return completion
8989

90+
9091
if os.environ.get('_ARGCOMPLETE'):
9192
try:
9293
import argcomplete.completers

_pytest/_code/code.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ def recursionindex(self):
343343
l.append(entry.frame.f_locals)
344344
return None
345345

346+
346347
co_equal = compile('__recursioncache_locals_1 == __recursioncache_locals_2',
347348
'?', 'eval')
348349

@@ -846,6 +847,7 @@ def getrawcode(obj, trycall=True):
846847
return x
847848
return obj
848849

850+
849851
if sys.version_info[:2] >= (3, 5): # RecursionError introduced in 3.5
850852
def is_recursion_error(excinfo):
851853
return excinfo.errisinstance(RecursionError) # noqa

_pytest/_code/source.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ def findsource(obj):
265265
source.lines = [line.rstrip() for line in sourcelines]
266266
return source, lineno
267267

268+
268269
def getsource(obj, **kwargs):
269270
import _pytest._code
270271
obj = _pytest._code.getrawcode(obj)
@@ -275,6 +276,7 @@ def getsource(obj, **kwargs):
275276
assert isinstance(strsrc, str)
276277
return Source(strsrc, **kwargs)
277278

279+
278280
def deindent(lines, offset=None):
279281
if offset is None:
280282
for line in lines:
@@ -288,6 +290,7 @@ def deindent(lines, offset=None):
288290
if offset == 0:
289291
return list(lines)
290292
newlines = []
293+
291294
def readline_generator(lines):
292295
for line in lines:
293296
yield line + '\n'

_pytest/assertion/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,12 @@ def install_importhook(config):
8080
config._assertstate.hook = hook = rewrite.AssertionRewritingHook(config)
8181
sys.meta_path.insert(0, hook)
8282
config._assertstate.trace('installed rewrite import hook')
83+
8384
def undo():
8485
hook = config._assertstate.hook
8586
if hook is not None and hook in sys.meta_path:
8687
sys.meta_path.remove(hook)
88+
8789
config.add_cleanup(undo)
8890
return hook
8991

_pytest/assertion/rewrite.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ def _write_pyc(state, co, source_stat, pyc):
276276
fp.close()
277277
return True
278278

279+
279280
RN = "\r\n".encode("utf-8")
280281
N = "\n".encode("utf-8")
281282

_pytest/capture.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ def suspendcapture_item(self, item, when, in_=False):
152152
item.add_report_section(when, "stdout", out)
153153
item.add_report_section(when, "stderr", err)
154154

155+
155156
error_capsysfderror = "cannot use capsys and capfd at the same time"
156157

157158

_pytest/config.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,11 @@ def main(args=None, plugins=None):
6565
class cmdline: # compatibility namespace
6666
main = staticmethod(main)
6767

68+
6869
class UsageError(Exception):
6970
""" error in pytest usage or invocation"""
7071

72+
7173
_preinit = []
7274

7375
default_plugins = (
@@ -818,9 +820,11 @@ class Notset:
818820
def __repr__(self):
819821
return "<NOTSET>"
820822

823+
821824
notset = Notset()
822825
FILE_OR_DIR = 'file_or_dir'
823826

827+
824828
class Config(object):
825829
""" access to configuration values, pluginmanager and plugin hooks. """
826830

@@ -843,9 +847,11 @@ def __init__(self, pluginmanager):
843847
self._warn = self.pluginmanager._warn
844848
self.pluginmanager.register(self, "pytestconfig")
845849
self._configured = False
850+
846851
def do_setns(dic):
847852
import pytest
848853
setns(pytest, dic)
854+
849855
self.hook.pytest_namespace.call_historic(do_setns, {})
850856
self.hook.pytest_addoption.call_historic(kwargs=dict(parser=self._parser))
851857

_pytest/debugging.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ def pytest_configure(config):
3131
pytestPDB._pdb_cls = pdb_cls
3232

3333
old = (pdb.set_trace, pytestPDB._pluginmanager)
34+
3435
def fin():
3536
pdb.set_trace, pytestPDB._pluginmanager = old
3637
pytestPDB._config = None
3738
pytestPDB._pdb_cls = pdb.Pdb
39+
3840
pdb.set_trace = pytest.set_trace
3941
pytestPDB._pluginmanager = config.pluginmanager
4042
pytestPDB._config = config

_pytest/fixtures.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ def pytest_sessionstart(session):
3232
def scopeproperty(name=None, doc=None):
3333
def decoratescope(func):
3434
scopename = name or func.__name__
35+
3536
def provide(self):
3637
if func.__name__ in scope2props[self.scope]:
3738
return func(self)
3839
raise AttributeError("%s not available in %s-scoped context" % (
3940
scopename, self.scope))
41+
4042
return property(provide, None, None, func.__doc__)
4143
return decoratescope
4244

_pytest/helpconfig.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,14 @@ def pytest_cmdline_parse():
4141
config.trace.root.setwriter(debugfile.write)
4242
undo_tracing = config.pluginmanager.enable_tracing()
4343
sys.stderr.write("writing pytestdebug information to %s\n" % path)
44+
4445
def unset_tracing():
4546
debugfile.close()
4647
sys.stderr.write("wrote pytestdebug information to %s\n" %
4748
debugfile.name)
4849
config.trace.root.setwriter(None)
4950
undo_tracing()
51+
5052
config.add_cleanup(unset_tracing)
5153

5254
def pytest_cmdline_main(config):

0 commit comments

Comments
 (0)