Skip to content

Commit

Permalink
Testing error on invalid source
Browse files Browse the repository at this point in the history
  • Loading branch information
idomic committed Feb 26, 2022
1 parent e33f858 commit 62c8870
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/spec/test_taskspec.py
Expand Up @@ -437,6 +437,21 @@ def test_error_on_invalid_product_class(backup_spec_with_functions_flat,
assert str(excinfo.value) == expected


def test_error_on_invalid_source(backup_spec_with_functions_flat, tmp_imports):
meta = Meta.default_meta({'extract_product': False})

spec = {'source': 'someinvalidstring', 'product': 'output_product'}

with pytest.raises(DAGSpecInitializationError) as excinfo:
TaskSpec(spec, meta=meta, project_root='.').to_task(dag=DAG())

expected = ("Failed to determine task source 'someinvalidstring'\n"
"Valid extensions are: '.R', '.Rmd', '.ipynb', '.py', '.r', "
"'.sh', and '.sql'\nYou can also define functions as "
"[module_name].[function_name]")
assert str(excinfo.value) == expected


@pytest.fixture
def grid_spec():
return {
Expand Down

0 comments on commit 62c8870

Please sign in to comment.