← Back to team overview

cloud-init-dev team mailing list archive

[Merge] lp:~harlowja/cloud-init/fix-digital-ocean-test-py26 into lp:cloud-init

 

Joshua Harlow has proposed merging lp:~harlowja/cloud-init/fix-digital-ocean-test-py26 into lp:cloud-init.

Requested reviews:
  cloud init development team (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~harlowja/cloud-init/fix-digital-ocean-test-py26/+merge/240167

Fix the digital ocean test on py2.6

The digital ocean datasource test is using assertIs which
is only created/existent on py2.7, so for the older py2.6
we need to add similar logic so that the test works correctly
there.

-- 
https://code.launchpad.net/~harlowja/cloud-init/fix-digital-ocean-test-py26/+merge/240167
Your team cloud init development team is requested to review the proposed merge of lp:~harlowja/cloud-init/fix-digital-ocean-test-py26 into lp:cloud-init.
=== modified file 'tests/unittests/helpers.py'
--- tests/unittests/helpers.py	2014-07-23 16:56:39 +0000
+++ tests/unittests/helpers.py	2014-10-30 20:20:20 +0000
@@ -35,6 +35,11 @@
 if PY26:
     # For now add these on, taken from python 2.7 + slightly adjusted
     class TestCase(unittest.TestCase):
+        def assertIs(self, expr1, expr2, msg=None):
+            if expr1 is not expr2:
+                standardMsg = '%r is not %r' % (expr1, expr2)
+                self.fail(self._formatMessage(msg, standardMsg))
+
         def assertIn(self, member, container, msg=None):
             if member not in container:
                 standardMsg = '%r not found in %r' % (member, container)


Follow ups