示例#1
0
def run(app, host, port):
    print_banner()
    pids = spawn_worker_processes()
    monkey.patch_all()

    app.running_context.executor.initialize_threading(app, pids)
    # The order of these imports matter for initialization (should probably be fixed)

    server = setup_server(app, host, port)
    server.serve_forever()
示例#2
0
    def setUpClass(cls):
        initialize_test_config()
        walkoff.config.Config.write_values_to_file()

        cls.app = create_app(walkoff.config.Config)
        cls.context = cls.app.test_request_context()
        cls.context.push()

        pids = spawn_worker_processes()
        cls.app.running_context.executor.initialize_threading(cls.app, pids)
    def setUpClass(cls):
        execution_db_help.setup_dbs()

        from walkoff.multiprocessedexecutor.multiprocessedexecutor import spawn_worker_processes
        walkoff.config.config.num_processes = 2
        pids = spawn_worker_processes(
            worker_environment_setup=modified_setup_worker_env)
        multiprocessedexecutor.initialize_threading(pids)
        walkoff.appgateway.cache_apps(config.test_apps_path)
        walkoff.config.config.load_app_apis(apps_path=config.test_apps_path)
        walkoff.config.config.num_processes = 2
示例#4
0
    def setUpClass(cls):
        if cls != ServerTestCase and cls.setUp != ServerTestCase.setUp:
            original_setup = cls.setUp

            def setup_override(self, *args, **kwargs):
                ServerTestCase.setUp(self)
                return original_setup(self, *args, **kwargs)

            cls.setUp = setup_override

        if cls != ServerTestCase and cls.tearDown != ServerTestCase.tearDown:
            original_teardown = cls.tearDown

            def teardown_override(self, *args, **kwargs):
                cls.preTearDown(self)
                ServerTestCase.tearDown(self)
                return original_teardown(self, *args, **kwargs)

            cls.tearDown = teardown_override

        if (tests.config.test_data_dir_name not in os.listdir(tests.config.test_path)
                or os.path.isfile(tests.config.test_data_path)):
            if os.path.isfile(tests.config.test_data_path):
                os.remove(tests.config.test_data_path)
            os.makedirs(tests.config.test_data_path)

        execution_db_help.setup_dbs()

        walkoff.appgateway.cache_apps(path=tests.config.test_apps_path)
        walkoff.config.config.app_apis = {}
        walkoff.config.config.load_app_apis(apps_path=tests.config.test_apps_path)
        walkoff.config.config.num_processes = 2

        from walkoff.server import flaskserver
        cls.context = flaskserver.app.test_request_context()
        cls.context.push()

        from walkoff.server.app import create_user
        create_user()
        if cls.patch:
            MultiprocessedExecutor.initialize_threading = mock_initialize_threading
            MultiprocessedExecutor.shutdown_pool = mock_shutdown_pool
            MultiprocessedExecutor.wait_and_reset = mock_wait_and_reset
            flaskserver.running_context.executor.initialize_threading()
        else:
            from walkoff.multiprocessedexecutor.multiprocessedexecutor import spawn_worker_processes
            pids = spawn_worker_processes(worker_environment_setup=modified_setup_worker_env)
            flaskserver.running_context.executor.initialize_threading(pids)
示例#5
0
    def setUpClass(cls):
        initialize_test_config()
        cls.conf = walkoff.config.Config

        if cls != ServerTestCase and cls.setUp != ServerTestCase.setUp:
            original_setup = cls.setUp

            def setup_override(self, *args, **kwargs):
                ServerTestCase.setUp(self)
                return original_setup(self, *args, **kwargs)

            cls.setUp = setup_override

        if cls != ServerTestCase and cls.tearDown != ServerTestCase.tearDown:
            original_teardown = cls.tearDown

            def teardown_override(self, *args, **kwargs):
                cls.preTearDown(self)
                ServerTestCase.tearDown(self)
                return original_teardown(self, *args, **kwargs)

            cls.tearDown = teardown_override

        if (cls.conf.DATA_DIR_NAME not in os.listdir(cls.conf.TEST_PATH)
                or os.path.isfile(cls.conf.DATA_PATH)):
            if os.path.isfile(cls.conf.DATA_PATH):
                os.remove(cls.conf.DATA_PATH)
            os.makedirs(cls.conf.DATA_PATH)

        cls.app = create_app(walkoff.config.Config)
        cls.app.testing = True
        cls.context = cls.app.test_request_context()
        cls.context.push()

        create_user()

        if cls.patch:
            MultiprocessedExecutor.initialize_threading = mock_initialize_threading
            MultiprocessedExecutor.shutdown_pool = mock_shutdown_pool
            MultiprocessedExecutor.wait_and_reset = mock_wait_and_reset
            cls.app.running_context.executor.initialize_threading(cls.app)
        else:
            walkoff.config.Config.write_values_to_file()
            pids = spawn_worker_processes()
            cls.app.running_context.executor.initialize_threading(cls.app, pids)
示例#6
0
def run(host, port):
    from walkoff.multiprocessedexecutor.multiprocessedexecutor import spawn_worker_processes
    setup_logger()
    print_banner()
    pids = spawn_worker_processes()
    monkey.patch_all()

    from scripts.compose_api import compose_api
    compose_api()

    from walkoff.server import flaskserver
    flaskserver.running_context.executor.initialize_threading(pids=pids)
    # The order of these imports matter for initialization (should probably be fixed)

    import walkoff.case.database as case_database
    case_database.initialize()

    server = setup_server(flaskserver.app, host, port)
    server.serve_forever()