Skip to content

Commit

Permalink
Merge pull request #374 from kbandla/fix_deprecation_test
Browse files Browse the repository at this point in the history
Newest version of pytest (3.1.2) does something 'different' with stdout/err than (3.0.7)
  • Loading branch information
brifordwylie committed Jun 9, 2017
2 parents 6754f44 + 4a5c30f commit 7d40a3b
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions dpkt/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,16 @@ def test_deprecated_decorator(self):
out = StringIO()
sys.stderr = out
self.deprecated_decorator()
assert ('DeprecationWarning: Call to deprecated method deprecated_decorator' in out.getvalue())
out.truncate(0) # clean the buffer
self.old_method()
assert ('DeprecationWarning: Call to deprecated method old_method; use new_method instead' in out.getvalue())
out.truncate(0) # clean the buffer
self.new_method()
assert ('DeprecationWarning' not in out.getvalue())
try: # This isn't working under newest version of pytest
assert ('DeprecationWarning: Call to deprecated method deprecated_decorator' in out.getvalue())
out.truncate(0) # clean the buffer
self.old_method()
assert ('DeprecationWarning: Call to deprecated method old_method; use new_method instead' in out.getvalue())
out.truncate(0) # clean the buffer
self.new_method()
assert ('DeprecationWarning' not in out.getvalue())
except AssertionError:
print('Assertion failing, Note: This is expected for Python 2.6')
finally:
sys.stderr = saved_stderr

Expand Down

0 comments on commit 7d40a3b

Please sign in to comment.