コード例 #1
0
ファイル: test_md_main.py プロジェクト: br00k/pyFF
 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)
コード例 #2
0
ファイル: test_md_api.py プロジェクト: skoranda/pyFF
 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
コード例 #3
0
ファイル: test_md_main.py プロジェクト: peter-/pyFF
 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)
コード例 #4
0
ファイル: test_md_main.py プロジェクト: Razumain/pyFF
    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)
コード例 #5
0
ファイル: test_md_api.py プロジェクト: clarin-eric/pyFF
    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
コード例 #6
0
 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)
コード例 #7
0
    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)
コード例 #8
0
    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)
コード例 #9
0
ファイル: test_pipeline.py プロジェクト: br00k/pyFF
 def setUp(self):
     SignerTestCase.setUpClass()
     print "setup called for PipeLineTest"
     self.templates = TemplateLookup(directories=[os.path.join(self.datadir, 'simple-pipeline')])
コード例 #10
0
ファイル: test_pipeline.py プロジェクト: br00k/pyFF
 def setUpClass(cls):
     SignerTestCase.setUpClass()
コード例 #11
0
 def setUp(self):
     SignerTestCase.setUpClass()
     self.templates = TemplateLookup(
         directories=[os.path.join(self.datadir, 'simple-pipeline')])
コード例 #12
0
 def setUpClass(cls):
     SignerTestCase.setUpClass()
コード例 #13
0
ファイル: test_pipeline.py プロジェクト: skanct/pyFF
 def setUp(self):
     SignerTestCase.setUpClass()
     print("setup called for PipeLineTest")
     self.templates = TemplateLookup(
         directories=[os.path.join(self.datadir, 'simple-pipeline')])
コード例 #14
0
ファイル: test_pipeline.py プロジェクト: leifj/pyFF
 def setUp(self):
     SignerTestCase.setUpClass()
     self.templates = TemplateLookup(directories=[os.path.join(self.datadir, 'simple-pipeline')])