def setUpClass(cls): SignerTestCase.setUpClass() cls.templates = TemplateLookup(directories=[os.path.join(cls.datadir, 'mdx')]) cls.mdx = tempfile.NamedTemporaryFile('w').name cls.mdx_template = cls.templates.get_template('mdx.fd') cls.pidfile = tempfile.NamedTemporaryFile('w').name with open(cls.mdx, "w") as fd: fd.write(cls.mdx_template.render(ctx=cls)) cls.curdir = os.getcwd() cls.port = find_unbound_port() print "Using port %d" % cls.port cls.pyffd_thread = Thread(target=run_pyffd, name="pyffd-test", args=["--loglevel=DEBUG", "--dir=%s" % cls.curdir, '-f', '-a', '-P', "%s" % cls.port, '-C', '-p', cls.pidfile, "--terminator", cls.mdx]) cls.pyffd_thread.start() sleep(1) for i in range(0,120): try: r = requests.get("http://127.0.0.1:%s/status" % cls.port) if r.json() and 'running' in r.json()['status']: return except Exception: pass sleep(1) raise ValueError("unable to start test pyffd server on port %d" % cls.port)
def setUpClass(cls): SignerTestCase.setUpClass() cls.templates = TemplateLookup(directories=[os.path.join(cls.datadir, 'mdx')]) cls.mdx = tempfile.NamedTemporaryFile('w').name cls.mdx_template = cls.templates.get_template('mdx.fd') with open(cls.mdx, "w") as fd: fd.write(cls.mdx_template.render(ctx=cls)) with open(cls.mdx, 'r') as r: print("".join(r.readlines())) cls._app = mkapp(cls.mdx) cls.app = lambda *args, **kwargs: cls._app
def setUpClass(cls): SignerTestCase.setUpClass() cls.templates = TemplateLookup(directories=[os.path.join(cls.datadir, 'mdx')]) cls.mdx = tempfile.NamedTemporaryFile('w').name cls.mdx_template = cls.templates.get_template('mdx.fd') cls.pidfile = tempfile.NamedTemporaryFile('w').name with open(cls.mdx, "w") as fd: fd.write(cls.mdx_template.render(ctx=cls)) cls.curdir = os.getcwd() cls.pyffd_thread = Thread(target=run_pyffd, name="pyffd-test", args=["--loglevel=INFO", "--dir=%s" % cls.curdir, '-f', '-a', '-C', '-p', cls.pidfile, "--terminator", cls.mdx]) cls.pyffd_thread.start() sleep(20)
def setUpClass(cls): SignerTestCase.setUpClass() cls.templates = TemplateLookup(directories=[os.path.join(cls.datadir, "mdx")]) cls.mdx = tempfile.NamedTemporaryFile("w").name cls.mdx_template = cls.templates.get_template("mdx.fd") cls.pidfile = tempfile.NamedTemporaryFile("w").name cls.logfile = tempfile.NamedTemporaryFile("w").name with open(cls.mdx, "w") as fd: fd.write(cls.mdx_template.render(ctx=cls)) cls.curdir = os.getcwd() cls.port = find_unbound_port() print "Using port %d, logging to %s" % (cls.port, cls.logfile) cls.pyffd_thread = Thread( target=run_pyffd, name="pyffd-test", args=[ "--loglevel=DEBUG", "--log=%s" % cls.logfile, "--dir=%s" % cls.curdir, "-f", "-a", "-P", "%s" % cls.port, "-C", "-p", cls.pidfile, "--allow_shutdown", cls.mdx, ], ) cls.pyffd_thread.start() sleep(1) for i in range(0, 60): try: r = requests.get("http://127.0.0.1:%s/status" % cls.port) if r.json() and "running" in r.json()["status"]: return print r.json() sleep(1) except Exception, ex: from traceback import print_exc print print_exc(ex) pass sleep(1)
def setUpClass(cls): SignerTestCase.setUpClass() config.local_copy_dir = tempfile.TemporaryDirectory() cls.templates = TemplateLookup( directories=[os.path.join(cls.datadir, 'mdx')]) cls.mdx = tempfile.NamedTemporaryFile('w').name # cls.mdx_template = cls.templates.get_template('mdx.fd') cls.test01 = os.path.join(cls.datadir, 'metadata', 'test01.xml') with open(cls.mdx, "w") as fd: fd.write(f""" - when update: - load: - {cls.test01} """) with open(cls.mdx, 'r') as r: print("".join(r.readlines())) cls._app = mkapp(cls.mdx) cls.app = lambda *args, **kwargs: cls._app
def setUpClass(cls): SignerTestCase.setUpClass() cls.templates = TemplateLookup( directories=[os.path.join(cls.datadir, 'mdx')]) cls.mdx = tempfile.NamedTemporaryFile('w').name cls.mdx_template = cls.templates.get_template('mdx.fd') cls.pidfile = tempfile.NamedTemporaryFile('w').name with open(cls.mdx, "w") as fd: fd.write(cls.mdx_template.render(ctx=cls)) cls.curdir = os.getcwd() cls.pyffd_thread = Thread(target=run_pyffd, name="pyffd-test", args=[ "--loglevel=INFO", "--dir=%s" % cls.curdir, '-f', '-a', '-C', '-p', cls.pidfile, "--terminator", cls.mdx ]) cls.pyffd_thread.start() sleep(20)
def setUpClass(cls): SignerTestCase.setUpClass() cls.templates = TemplateLookup( directories=[os.path.join(cls.datadir, 'mdx')]) cls.mdx = tempfile.NamedTemporaryFile('w').name cls.mdx_template = cls.templates.get_template('mdx.fd') cls.pidfile = tempfile.NamedTemporaryFile('w').name cls.logfile = tempfile.NamedTemporaryFile('w').name with open(cls.mdx, "w") as fd: fd.write(cls.mdx_template.render(ctx=cls)) with open(cls.mdx, 'r') as r: print("".join(r.readlines())) cls.curdir = os.getcwd() cls.port = find_unbound_port() print("Using port {:d}, logging to {}".format(cls.port, cls.logfile)) cls.pyffd_thread = Thread(target=run_pyffd, name="pyffd-test", args=[ "--loglevel=DEBUG", "--log=%s" % cls.logfile, "--dir=%s" % cls.curdir, '-f', '-a', '-P', "%s" % cls.port, '-C', '-p', cls.pidfile, "--allow_shutdown", cls.mdx ]) cls.pyffd_thread.start() sleep(1) for i in range(0, 60): try: r = requests.get("http://127.0.0.1:%s/status" % cls.port) if r.json() and 'running' in r.json()['status']: return print(r.json()) sleep(1) except Exception as ex: print(ex) pass sleep(1) raise ValueError("unable to start test pyffd server on port %d" % cls.port)
def setUpClass(cls): SignerTestCase.setUpClass() cls.templates = TemplateLookup( directories=[os.path.join(cls.datadir, 'mdx')]) cls.mdx = tempfile.NamedTemporaryFile('w').name cls.mdx_template = cls.templates.get_template('mdx.fd') cls.pidfile = tempfile.NamedTemporaryFile('w').name cls.logfile = tempfile.NamedTemporaryFile('w').name with open(cls.mdx, "w") as fd: fd.write(cls.mdx_template.render(ctx=cls)) cls.curdir = os.getcwd() cls.port = find_unbound_port() print "Using port %d, logging to %s" % (cls.port, cls.logfile) cls.pyffd_thread = Thread(target=run_pyffd, name="pyffd-test", args=[ "--loglevel=DEBUG", "--log=%s" % cls.logfile, "--dir=%s" % cls.curdir, '-f', '-a', '-P', "%s" % cls.port, '-C', '-p', cls.pidfile, "--allow_shutdown", cls.mdx ]) cls.pyffd_thread.start() sleep(1) for i in range(0, 60): try: r = requests.get("http://127.0.0.1:%s/status" % cls.port) if r.json() and 'running' in r.json()['status']: return print r.json() sleep(1) except Exception, ex: from traceback import print_exc print print_exc(ex) pass sleep(1)
def setUp(self): SignerTestCase.setUpClass() print "setup called for PipeLineTest" self.templates = TemplateLookup(directories=[os.path.join(self.datadir, 'simple-pipeline')])
def setUpClass(cls): SignerTestCase.setUpClass()
def setUp(self): SignerTestCase.setUpClass() self.templates = TemplateLookup( directories=[os.path.join(self.datadir, 'simple-pipeline')])
def setUp(self): SignerTestCase.setUpClass() print("setup called for PipeLineTest") self.templates = TemplateLookup( directories=[os.path.join(self.datadir, 'simple-pipeline')])
def setUp(self): SignerTestCase.setUpClass() self.templates = TemplateLookup(directories=[os.path.join(self.datadir, 'simple-pipeline')])