From 12b0e06cb6db76e60455d13269e6ff3fedab5812 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 16 Jun 2015 16:39:29 +0200 Subject: 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/ --- tests/test_paths.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'tests/test_paths.py') diff --git a/tests/test_paths.py b/tests/test_paths.py index 993ad02b..9fb98432 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, -- cgit v1.2.3