diff options
| author | Julian Andres Klode <jak@debian.org> | 2015-06-16 23:33:03 +0200 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2015-06-16 23:36:06 +0200 |
| commit | 6b1c6abb4d08522b41c129b4b426eeb16e03bd9a (patch) | |
| tree | 155cb029bcc7a4e5e226f055eab8dbe7107fb9dd /tests | |
| parent | b6055ab49ee5a605a1228e81885f552924ad998d (diff) | |
| download | python-apt-6b1c6abb4d08522b41c129b4b426eeb16e03bd9a.tar.gz | |
tests/test_paths.py: Add an 'always' warning filter, so it is reliable
Previously, the warning was not always issued, causing the test to
fail in some cases.
Also change the assertions to use the assert* methods of unittest,
and check that md5 and hash are mentioned in the deprecation
message.
Thanks: Adam Conrad
Gbp-Dch: ignore
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_paths.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/test_paths.py b/tests/test_paths.py index 222848f7..d647e6e2 100644 --- a/tests/test_paths.py +++ b/tests/test_paths.py @@ -42,13 +42,17 @@ class TestPath(unittest.TestCase): AcquireFile """ with warnings.catch_warnings(record=True) as caught_warnings: + warnings.simplefilter("always") 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) + self.assertEqual(len(caught_warnings), 1) + self.assertTrue(issubclass(caught_warnings[0].category, + DeprecationWarning)) + self.assertIn("md5", str(caught_warnings[0].message)) + self.assertIn("hash", str(caught_warnings[0].message)) apt_pkg.AcquireFile( apt_pkg.Acquire(), "http://example.com", |
