def test_no_outputs_no_inputs_config_schema(): assert create_environment_config(no_input_no_output_pipeline()) with pytest.raises(PipelineConfigEvaluationError) as exc_context: create_environment_config(no_input_no_output_pipeline(), {'solids': {'return_one': {}}}) assert len(exc_context.value.errors) == 1 assert 'Error 1: Undefined field "return_one" at path root:solids' in exc_context.value.message
def test_basic_json_misnamed_output_config_schema(): with pytest.raises(PipelineConfigEvaluationError) as exc_context: create_environment_config( single_int_named_output_pipeline(), { 'solids': { 'return_named_one': {'outputs': [{'wrong_name': {'json': {'path': 'foo'}}}]} } }, ) assert len(exc_context.value.errors) == 1 assert 'Error 1: Undefined field "wrong_name"' in exc_context.value.message assert 'at path root:solids:return_named_one:outputs[0]' in exc_context.value.message
def test_basic_json_default_output_config_schema(): env = create_environment_config( single_int_output_pipeline(), { 'solids': { 'return_one': { 'outputs': [{ 'result': { 'json': { 'path': 'foo' } } }] } } }, ) assert env.solids['return_one'] assert env.solids['return_one'].outputs == [{ 'result': { 'json': { 'path': 'foo' } } }]
def test_no_outputs_one_input_config_schema(): assert create_environment_config( one_input_no_output_pipeline(), {'solids': {'take_input_return_nothing': {'inputs': {'dummy': {'value': 'value'}}}}}, ) with pytest.raises(PipelineConfigEvaluationError) as exc_context: create_environment_config( one_input_no_output_pipeline(), { 'solids': { 'take_input_return_nothing': { 'inputs': {'dummy': {'value': 'value'}}, 'outputs': {}, } } }, ) assert len(exc_context.value.errors) == 1 exp_msg = 'Error 1: Undefined field "outputs" at path root:solids:take_input_return_nothing' assert exp_msg in exc_context.value.message
def create_test_pipeline_execution_context(loggers=None, resources=None, tags=None): run_id = str(uuid.uuid4()) pipeline_def = PipelineDefinition(name='test_legacy_context', solids=[]) return construct_pipeline_execution_context( execution_metadata=ExecutionMetadata(run_id, tags=tags, loggers=loggers), pipeline=pipeline_def, execution_context=ExecutionContext(), resources=resources, environment_config=create_environment_config(pipeline_def), )
def create_test_pipeline_execution_context(loggers=None, resources=None, tags=None): run_id = str(uuid.uuid4()) pipeline_def = PipelineDefinition(name='test_legacy_context', solids=[]) return construct_pipeline_execution_context( run_config=RunConfig(run_id, tags=tags, loggers=loggers), pipeline=pipeline_def, execution_context=ExecutionContext(), resources=resources, environment_config=create_environment_config(pipeline_def), run_storage=InMemoryRunStorage(), intermediates_manager=InMemoryIntermediatesManager(), )