Skip to content

Commit b2eb2b6

Browse files
committed
Skip warning test on older version of python
due to pytest bug pytest-dev/pytest#840
1 parent 6da9723 commit b2eb2b6

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

tasks.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def flake():
3333
os.path.join('webargs', 'async.py'),
3434
os.path.join('webargs', 'aiohttpparser.py'),
3535
os.path.join('examples', 'annotations_example.py'),
36+
'build',
3637
]
3738
cmd += ' --exclude={0}'.format(','.join(excludes))
3839
run(cmd, echo=True)

tests/test_core.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,10 +519,17 @@ def viewfunc(email, password):
519519
return {'email': email, 'password': password}
520520
assert viewfunc() == {'email': '[email protected]', 'password': 'bar'}
521521

522+
# Must skip on older versions of python due to
523+
# https://github.com/pytest-dev/pytest/issues/840
524+
@pytest.mark.skipif(sys.version_info < (3, 4),
525+
reason="Skipping due to a bug in pytest's warning recording")
522526
def test_warning_raised_if_schema_is_not_in_strict_mode(
523-
self, web_request, parser, recwarn):
524-
parser.parse(self.UserSchema(strict=False), web_request)
525-
warning = recwarn.pop(UserWarning)
527+
self, web_request, parser
528+
):
529+
530+
with pytest.warns(UserWarning) as record:
531+
parser.parse(self.UserSchema(strict=False), web_request)
532+
warning = record[0]
526533
assert 'strict=True' in str(warning.message)
527534

528535
def test_use_kwargs_stacked(self, web_request, parser):

tox.ini

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ envlist =py26,py27,py33,py34,py35
44
deps=
55
py26: ordereddict
66
-rdev-requirements.txt
7+
{py34,py35}: -rdev-requirements.txt
78
commands=
8-
flake8 webargs
9-
py.test
10-
9+
invoke test

0 commit comments

Comments
 (0)