[server/test] remove dependency on a pyro name server (closes #2801737) stable
authorJulien Cristau <julien.cristau@logilab.fr>
Mon, 08 Apr 2013 18:38:20 +0200
branchstable
changeset 8874 522bdba66690
parent 8873 280c32415059
child 8875 a2b4f245aa57
[server/test] remove dependency on a pyro name server (closes #2801737) Use a direct pyroloc:// url instead of going through a NS.
server/test/unittest_repository.py
--- a/server/test/unittest_repository.py	Mon Apr 08 17:30:53 2013 +0200
+++ b/server/test/unittest_repository.py	Mon Apr 08 18:38:20 2013 +0200
@@ -42,9 +42,6 @@
 from cubicweb.server.hook import Hook
 from cubicweb.server.sources import native
 
-# start name server anyway, process will fail if already running
-os.system('pyro-ns >/dev/null 2>/dev/null &')
-
 
 class RepositoryTC(CubicWebTC):
     """ singleton providing access to a persistent storage for entities
@@ -350,10 +347,12 @@
         import Pyro
         Pyro.config.PYRO_MULTITHREADED = 0
         done = []
-        # the client part has to be in the thread due to sqlite limitations
-        t = threading.Thread(target=self._pyro_client, args=(done,))
+        self.repo.config.global_set_option('pyro-ns-host', 'NO_PYRONS')
+        daemon = self.repo.pyro_register()
         try:
-            daemon = self.repo.pyro_register()
+            uri = self.repo.pyro_uri.replace('PYRO', 'pyroloc')
+            # the client part has to be in the thread due to sqlite limitations
+            t = threading.Thread(target=self._pyro_client, args=(uri, done))
             t.start()
             while not done:
                 daemon.handleRequests(1.0)
@@ -366,8 +365,8 @@
             pyro_ext._DAEMONS.clear()
 
 
-    def _pyro_client(self, done):
-        cnx = connect('pyro:///'+self.repo.config.appid,
+    def _pyro_client(self, uri, done):
+        cnx = connect(uri,
                       u'admin', password='gingkow',
                       initlog=False) # don't reset logging configuration
         try: