Ejemplo n.º 1
0
    def runSetUp(self):
        self.pyroPort = util.getFreeTcpPort(10000, 11000)
        self.httpPort = util.getFreeTcpPort(11000, 12000)

        os.mkdir("./fakeroot")
        os.mkdir("./fakeroot/run")
        os.mkdir("./fakeroot/var")
        os.mkdir("./fakeroot/var/log")
Ejemplo n.º 2
0
    def setUp(self):
        self.serverPort = util.getFreeTcpPort()

        buf = ""
        buf += "import os\n"
        buf += "import sys\n"
        buf += "from gi.repository import GLib\n"
        buf += "sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), \"../src\"))\n"
        buf += "from util import util\n"
        buf += "\n"
        buf += "class ServiceObject:\n"
        buf += "    def method(self):\n"
        buf += "        return 100\n"
        buf += "\n"
        buf += "mainloop = GLib.MainLoop()\n"
        buf += "\n"
        buf += "pyroServer = util.PyroServer(\"127.0.0.1\", %d)\n" % (
            self.serverPort)
        buf += "pyroServer.register(\"main\", ServiceObject())\n"
        buf += "pyroServer.attach(mainloop)\n"
        buf += "\n"
        buf += "mainloop.run()\n"
        with open("./_test_server.py", "w") as f:
            f.write(buf)

        self.serverProc = subprocess.Popen("python3 ./_test_server.py",
                                           shell=True,
                                           universal_newlines=True)
        time.sleep(1)
Ejemplo n.º 3
0
    def setUp(self):
        self.serverPort = util.getFreeTcpPort()

        buf = ""
        buf += "import os\n"
        buf += "import sys\n"
        buf += "from gi.repository import GLib\n"
        buf += "sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), \"../src\"))\n"
        buf += "from util import util\n"
        buf += "\n"
        buf += "class ServiceObject:\n"
        buf += "    def method(self):\n"
        buf += "        return 100\n"
        buf += "\n"
        buf += "mainloop = GLib.MainLoop()\n"
        buf += "\n"
        buf += "pyroServer = util.PyroServer(\"127.0.0.1\", %d)\n" % (self.serverPort)
        buf += "pyroServer.register(\"main\", ServiceObject())\n"
        buf += "pyroServer.attach(mainloop)\n"
        buf += "\n"
        buf += "mainloop.run()\n"
        with open("./_test_server.py", "w") as f:
            f.write(buf)

        self.serverProc = subprocess.Popen("python3 ./_test_server.py", shell=True, universal_newlines=True)
        time.sleep(1)