summaryrefslogtreecommitdiff
path: root/tests/test_auth.py
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2012-06-29 16:10:40 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2012-06-29 16:10:40 +0200
commit794e9321c92aab78c3b7123d765967ba67b79851 (patch)
tree9886905374b0ae9bc0043f12be0797c6f8f0af35 /tests/test_auth.py
parent43aee9eda68e374067d6d6a9c4dd3c3e9b986041 (diff)
parent6ec2e17ae6712655c1bacffa8c6ecde5f8810960 (diff)
downloadpython-apt-794e9321c92aab78c3b7123d765967ba67b79851.tar.gz
merged from debian-sid
Diffstat (limited to 'tests/test_auth.py')
-rw-r--r--tests/test_auth.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/test_auth.py b/tests/test_auth.py
index f975c670..99c40db5 100644
--- a/tests/test_auth.py
+++ b/tests/test_auth.py
@@ -7,7 +7,7 @@ import tempfile
import time
import unittest
-if sys.version_info.major > 2:
+if sys.version_info[0] > 2:
from http.server import HTTPServer
from http.server import SimpleHTTPRequestHandler as HTTPRequestHandler
else:
@@ -107,6 +107,18 @@ class TestAuthKeys(unittest.TestCase):
"""Test handling of keys for signed repositories."""
+ if sys.version_info[0] == 2 and sys.version_info[1] < 7:
+ def addCleanup(self, function, *args, **kwds):
+ try:
+ self.cleanup.append(lambda: function(*args, **kwds))
+ except AttributeError:
+ self.cleanup = [lambda: function(*args, **kwds)]
+
+ def tearDown(self):
+ for f in self.cleanup:
+ f()
+ self.cleanup = []
+
def setUp(self):
# reset any config manipulations done in the individual tests
apt_pkg.init_config()