コード例 #1
0
 def _get_client(self, host):
     """Return a vaurien client, or raise a ValueError if "name"
        doesn't exists.
     """
     parts = urlparse(host)
     host, port = parts.netloc.split(':', -1)
     return Client(host, port)
コード例 #2
0
    def setUp(self):
        port = 8009
        cmd = '%s -m vaurien.tests.support %s' % (sys.executable, port)
        self.process = Popen(cmd.split(' '))

        # wait for the server to start
        time.sleep(1.)
        self.client = Client('localhost', port)
コード例 #3
0
ファイル: test_proxy.py プロジェクト: zousenming/vaurien
    def setUp(self):
        self._proxy_pid = start_proxy(log_output='/dev/null',
                                      log_level='error')
        self._web = start_simplehttp_server()
        time.sleep(.2)
        try:
            if self._web.poll():
                raise ValueError("Could not start the proxy")

            self.client = Client()

            assert self.client.get_behavior() == 'dummy'
        except Exception:
            self.tearDown()
            raise