[migration/test] avoid test interdependency by removing fakecustomtype cube
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 15 Dec 2015 10:20:26 +0100
changeset 11007 f9386e3bf3e8
parent 11006 096adb786873
child 11008 de86c6592cc7
[migration/test] avoid test interdependency by removing fakecustomtype cube There is still a failing test afterward but it doesn't seem related to changes in this series.
server/test/unittest_migractions.py
--- a/server/test/unittest_migractions.py	Wed Dec 09 17:44:18 2015 +0100
+++ b/server/test/unittest_migractions.py	Tue Dec 15 10:20:26 2015 +0100
@@ -291,14 +291,17 @@
 
     def test_add_cube_with_custom_final_type(self):
         with self.mh() as (cnx, mh):
-            mh.cmd_add_cube('fakecustomtype')
-            self.assertIn('Numeric', self.schema)
-            self.assertTrue(self.schema['Numeric'].final)
-            rdef = self.schema['num'].rdefs[('Location', 'Numeric')]
-            self.assertEqual(rdef.scale, 10)
-            self.assertEqual(rdef.precision, 18)
-            fields = self.table_schema(mh, '%sLocation' % SQL_PREFIX)
-            self.assertEqual(fields['%snum' % SQL_PREFIX], ('numeric', None)) # XXX
+            try:
+                mh.cmd_add_cube('fakecustomtype')
+                self.assertIn('Numeric', self.schema)
+                self.assertTrue(self.schema['Numeric'].final)
+                rdef = self.schema['num'].rdefs[('Location', 'Numeric')]
+                self.assertEqual(rdef.scale, 10)
+                self.assertEqual(rdef.precision, 18)
+                fields = self.table_schema(mh, '%sLocation' % SQL_PREFIX)
+                self.assertEqual(fields['%snum' % SQL_PREFIX], ('numeric', None)) # XXX
+            finally:
+                mh.cmd_drop_cube('fakecustomtype')
 
     def test_add_drop_entity_type(self):
         with self.mh() as (cnx, mh):