test/unittest_migration.py
changeset 9576 5d4f662f5e31
parent 9460 a2a0bc984863
child 9723 46ad7d474d3d
--- a/test/unittest_migration.py	Wed Mar 05 11:22:20 2014 +0100
+++ b/test/unittest_migration.py	Wed Mar 05 12:35:37 2014 +0100
@@ -105,10 +105,9 @@
         handler.init_test_database()
         handler.build_db_cache()
         repo, cnx = handler.get_repo_and_cnx()
-        cu = cnx.cursor()
-        self.assertEqual(cu.execute('Any SN WHERE X is CWUser, X login "admin", X in_state S, S name SN').rows,
-                          [['activated']])
-        cnx.close()
+        with cnx:
+            self.assertEqual(cnx.execute('Any SN WHERE X is CWUser, X login "admin", X in_state S, S name SN').rows,
+                             [['activated']])
         repo.shutdown()
 
 if __name__ == '__main__':