Skip to content

Commit 799b72c

Browse files
author
Anthony Sottile
authored
Merge pull request pytest-dev#4213 from asottile/flake8_master_fixes
Fixes for flake8 master
2 parents fc0f89a + cb39bd0 commit 799b72c

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

doc/en/example/py2py3/test_py2.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
21
def test_exception_syntax():
32
try:
4-
0/0
3+
0 / 0
54
except ZeroDivisionError, e:
6-
pass
5+
assert e

doc/en/example/py2py3/test_py3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ def test_exception_syntax():
22
try:
33
0 / 0
44
except ZeroDivisionError as e:
5-
pass
5+
assert e

src/_pytest/assertion/rewrite.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,10 +706,9 @@ def run(self, mod):
706706
setattr(node, name, new)
707707
elif (
708708
isinstance(field, ast.AST)
709-
and
710709
# Don't recurse into expressions as they can't contain
711710
# asserts.
712-
not isinstance(field, ast.expr)
711+
and not isinstance(field, ast.expr)
713712
):
714713
nodes.append(field)
715714

src/_pytest/pathlib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ def make_numbered_dir_with_cleanup(root, prefix, keep, lock_timeout):
245245
p = make_numbered_dir(root, prefix)
246246
lock_path = create_cleanup_lock(p)
247247
register_cleanup_lock_removal(lock_path)
248-
except Exception as e:
249-
pass
248+
except Exception as exc:
249+
e = exc
250250
else:
251251
consider_lock_dead_if_created_before = p.stat().st_mtime - lock_timeout
252252
cleanup_numbered_dir(

0 commit comments

Comments
 (0)