def parse()

in benchmarks/perf-tool/okpt/io/config/parsers/test.py [0:0]


    def parse(self, file_obj: TextIOWrapper) -> TestConfig:
        """See base class."""
        config_obj = super().parse(file_obj)

        implicit_step_config = dict()
        if 'endpoint' in config_obj:
            implicit_step_config['endpoint'] = config_obj['endpoint']

        # Each step should have its own parse - take the config object and check if its valid
        setup = []
        if 'setup' in config_obj:
            setup = [create_step(StepConfig(step["name"], step, implicit_step_config)) for step in config_obj['setup']]

        steps = [create_step(StepConfig(step["name"], step, implicit_step_config)) for step in config_obj['steps']]

        cleanup = []
        if 'cleanup' in config_obj:
            cleanup = [create_step(StepConfig(step["name"], step, implicit_step_config)) for step
                       in config_obj['cleanup']]

        test_config = TestConfig(
            endpoint=config_obj['endpoint'],
            test_name=config_obj['test_name'],
            test_id=config_obj['test_id'],
            num_runs=config_obj['num_runs'],
            show_runs=config_obj['show_runs'],
            setup=setup,
            steps=steps,
            cleanup=cleanup
        )

        return test_config