Change in vdsm[master]: tests: lib: drop forward port from python 2.7

fromani at redhat.com fromani at redhat.com
Wed May 13 13:54:03 UTC 2015


Francesco Romani has uploaded a new change for review.

Change subject: tests: lib: drop forward port from python 2.7
......................................................................

tests: lib: drop forward port from python 2.7

Since we now depend on (distributions which ship) python 2.7,
we can drop the forward ports we added back in time, and make
use of all the new utilities found in modern unittest module.

Change-Id: Id943e5db3f972ccf89291f3d7c112db7907eba1d
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M tests/testlib.py
1 file changed, 0 insertions(+), 65 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/79/40879/1

diff --git a/tests/testlib.py b/tests/testlib.py
index 35c870a..c272c36 100644
--- a/tests/testlib.py
+++ b/tests/testlib.py
@@ -180,71 +180,6 @@
         with context:
             callableObj(*args, **kwargs)
 
-    # FIXME: This is a forward port of the assertIn from python
-    #        2.7, remove when no loger supporting earlier versions
-    def assertIn(self, member, container, msg=None):
-        """
-        Just like self.assertTrue(a in b), but with a nicer default message.
-        """
-        if member not in container:
-            if msg is None:
-                msg = '%s not found in %s' % (safe_repr(member),
-                                              safe_repr(container))
-            raise self.failureException(msg)
-
-    # FIXME: This is a forward port of the assertNotIn from python
-    #        2.7, remove when no loger supporting earlier versions
-    def assertNotIn(self, member, container, msg=None):
-        """
-        Just like self.assertTrue(a not in b), but with a nicer default message
-        """
-        if member in container:
-            if msg is None:
-                msg = '%s unexpectedly found in %s' % (safe_repr(member),
-                                                       safe_repr(container))
-            raise self.failureException(msg)
-
-    # FIXME: This is a forward port of the assertAlmostEqual from python
-    #        2.7, remove when no longer supporting earlier versions
-    # we need the 'delta' keyword argument, which was added in python 2.7
-    def assertAlmostEqual(self, first, second, places=None,
-                          msg=None, delta=None):
-        """Fail if the two objects are unequal as determined by their
-           difference rounded to the given number of decimal places
-           (default 7) and comparing to zero, or by comparing that the
-           between the two objects is more than the given delta.
-
-           Note that decimal places (from zero) are usually not the same
-           as significant digits (measured from the most signficant digit).
-
-           If the two objects compare equal then they will automatically
-           compare almost equal.
-        """
-        if first == second:
-            # shortcut
-            return
-        if delta is not None and places is not None:
-            raise TypeError("specify delta or places not both")
-
-        if delta is not None:
-            if abs(first - second) <= delta:
-                return
-
-            standardMsg = '%s != %s within %s delta' % (safe_repr(first),
-                                                        safe_repr(second),
-                                                        safe_repr(delta))
-        else:
-            if places is None:
-                places = 7
-
-            if round(abs(second-first), places) == 0:
-                return
-
-            standardMsg = '%s != %s within %r places' % (
-                safe_repr(first), safe_repr(second), places)
-        msg = self._formatMessage(msg, standardMsg)
-        raise self.failureException(msg)
-
     @contextmanager
     def assertElapsed(self, expected, tolerance=0.5):
         start = vdsm.utils.monotonic_time()


-- 
To view, visit https://gerrit.ovirt.org/40879
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id943e5db3f972ccf89291f3d7c112db7907eba1d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>


More information about the vdsm-patches mailing list