diff --git a/provenance/core.py b/provenance/core.py index b54aff0..46deba2 100644 --- a/provenance/core.py +++ b/provenance/core.py @@ -287,7 +287,7 @@ def _provenance_wrapper(*args, **kargs): msg = 'The default repo is not set. ' msg += 'You may want to add the `default_repo` key to your call to `provenance.load_config.` ' msg += 'e.g., provenance\.load_config({\'default_repo\': , ...})' - raise Exception(msg).with_traceback(e.__traceback__) + raise AttributeError(msg).with_traceback(e.__traceback__) else: artifact = None diff --git a/tests/provenance/test_core.py b/tests/provenance/test_core.py index 634ed39..21ea668 100644 --- a/tests/provenance/test_core.py +++ b/tests/provenance/test_core.py @@ -19,6 +19,19 @@ def spit(filename, content): with open(filename, "w") as f: f.write(content) + +def test_errors_without_default_repo(): + @p.provenance() + def my_add(x, y): + print("Executed") + return x + y + + with pytest.raises(AttributeError) as err: + my_add(1, 4) + + assert 'The default repo is not set' in err.message + + def test_integration_test(repo): @p.provenance(version=0, name='initial_data') def load_data(filename):