WIP: Patch up unittest to support assertGreater for ancient Python

master
Mike Gerber 10 years ago
parent 0e4e6edfa6
commit 52de7c2da7

@ -7,6 +7,7 @@ import unittest
from check_kernel import clean_kernel_version, Version
import check_kernel
def patch_object(obj, function, return_value=None):
"""A simple replacement for unittest.mock.patch_object()
@ -17,6 +18,13 @@ def patch_object(obj, function, return_value=None):
obj.__dict__[function] = our_function
# Patch up unittest
if not hasattr(unittest, 'assertGreater'):
unittest.assertGreater = lambda self, a, b: self.assertTrue(a > b)
if not hasattr(unittest, 'assertLess'):
unittest.assertLess = lambda self, a, b: self.assertTrue(a < b)
class CleanKernelVersionTestCase(unittest.TestCase):
def testDebian(self):
versions = [('3.16.7-ckt9-3~deb8u2', '3.16.7-ckt9-3~deb8u2')]

Loading…
Cancel
Save