[test] silence warnings for unittest_cwctl by upgrading to new 3.19 API
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 04 Apr 2014 12:45:12 +0200
changeset 9639 74b3db5bb41d
parent 9638 3046bae3ce31
child 9640 26ea1c4387bf
[test] silence warnings for unittest_cwctl by upgrading to new 3.19 API
test/unittest_cwctl.py
--- a/test/unittest_cwctl.py	Fri Apr 04 13:49:03 2014 +0200
+++ b/test/unittest_cwctl.py	Fri Apr 04 12:45:12 2014 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
 #
 # This file is part of CubicWeb.
@@ -43,21 +43,22 @@
 class CubicWebShellTC(CubicWebTC):
 
     def test_process_script_args_context(self):
-        repo = self.cnx._repo
-        mih = ServerMigrationHelper(None, repo=repo, cnx=self.cnx,
-                                    interactive=False,
-                                    # hack so it don't try to load fs schema
-                                    schema=1)
-        scripts = {'script1.py': list(),
-                   'script2.py': ['-v'],
-                   'script3.py': ['-vd', '-f', 'FILE.TXT'],
-                  }
-        mih.cmd_process_script(join(self.datadir, 'scripts', 'script1.py'),
-                               funcname=None)
-        for script, args in scripts.items():
-            scriptname = os.path.join(self.datadir, 'scripts', script)
-            self.assert_(os.path.exists(scriptname))
-            mih.cmd_process_script(scriptname, None, scriptargs=args)
+        repo = self.repo
+        with self.admin_access.client_cnx() as cnx:
+            mih = ServerMigrationHelper(None, repo=repo, cnx=cnx,
+                                        interactive=False,
+                                        # hack so it don't try to load fs schema
+                                        schema=1)
+            scripts = {'script1.py': list(),
+                       'script2.py': ['-v'],
+                       'script3.py': ['-vd', '-f', 'FILE.TXT'],
+                      }
+            mih.cmd_process_script(join(self.datadir, 'scripts', 'script1.py'),
+                                   funcname=None)
+            for script, args in scripts.items():
+                scriptname = os.path.join(self.datadir, 'scripts', script)
+                self.assert_(os.path.exists(scriptname))
+                mih.cmd_process_script(scriptname, None, scriptargs=args)
 
 
 if __name__ == '__main__':