From 54a9d57088cb91611dfff7ad230f685ae2ed54cc Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Sat, 23 Feb 2008 13:11:26 +0000 Subject: [PATCH] Use warnings module for deprecation warnings, not logging. This makes it easy to disable them for unit-testing, prevents showing the same message multiple times, and allows showing the place in the caller where the deprecated function was used. --- tests/basetest.py | 4 ++++ zeroinstall/injector/gpg.py | 4 ++-- zeroinstall/injector/policy.py | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/basetest.py b/tests/basetest.py index bfcfc2f..989d0e0 100755 --- a/tests/basetest.py +++ b/tests/basetest.py @@ -2,6 +2,10 @@ import sys, tempfile, os, shutil, StringIO import unittest import logging +import warnings + +# It's OK to test deprecated features +warnings.filterwarnings("ignore", category = DeprecationWarning) # Catch silly mistakes... os.environ['HOME'] = '/home/idontexist' diff --git a/zeroinstall/injector/gpg.py b/zeroinstall/injector/gpg.py index 2e7d6c0..07034cd 100644 --- a/zeroinstall/injector/gpg.py +++ b/zeroinstall/injector/gpg.py @@ -13,7 +13,6 @@ import base64, re import os import tempfile import traceback -from logging import warn from trust import trust_db from model import SafeException @@ -313,7 +312,8 @@ def check_stream(stream): if start == "