diff options
| author | Julian Andres Klode <jak@debian.org> | 2015-06-16 14:39:29 (GMT) |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2015-06-16 14:39:29 (GMT) |
| commit | 12b0e06cb6db76e60455d13269e6ff3fedab5812 (patch) | |
| tree | 494c602be852f1eaf2fa7162bcdcb0eef732f8c4 | |
| parent | 8b97662a779800e5c22f554b361b0a638eca3a29 (diff) | |
tests/test_paths.py: Catch and assert the DeprecationWarning
This fixes Ubuntu autopkg test failure wily-adt-python-apt #12.
https://jenkins.qa.ubuntu.com/job/wily-adt-python-apt/12/
| -rw-r--r-- | tests/test_paths.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tests/test_paths.py b/tests/test_paths.py index 993ad02..9fb9843 100644 --- a/tests/test_paths.py +++ b/tests/test_paths.py @@ -4,6 +4,7 @@ import os import shutil import unittest +import warnings import apt_inst import apt_pkg @@ -40,10 +41,15 @@ class TestPath(unittest.TestCase): Ensure that both "md5" and "hash" is supported as keyword for AcquireFile """ - apt_pkg.AcquireFile( - apt_pkg.Acquire(), "http://example.com", - destfile=self.file_bytes, - md5="abcdef") + with warnings.catch_warnings(record=True) as caught_warnings: + apt_pkg.AcquireFile( + apt_pkg.Acquire(), "http://example.com", + destfile=self.file_bytes, + md5="abcdef") + + assert len(caught_warnings) == 1 + assert issubclass(caught_warnings[0].category, DeprecationWarning) + apt_pkg.AcquireFile( apt_pkg.Acquire(), "http://example.com", destfile=self.file_bytes, |
