Skip to content

Commit

Permalink
fixes tests
Browse files Browse the repository at this point in the history
  • Loading branch information
edublancas committed Dec 17, 2021
1 parent ba6ec4d commit f65a571
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/ploomber/products/metaproduct.py
Expand Up @@ -112,15 +112,15 @@ def client(self):
@task.setter
def task(self, value):
for p in self.products:
if hasattr(p, 'task'):
try:
p.task = value
else:
raise TypeError(
except AttributeError as e:
raise AttributeError(
"Expected MetaProduct to initialize with Product "
"instancess (which have a 'task' attribute), but "
f"got {p!r}, an object of type {type(p)}. Replace it "
"with a valid Product object. If this is a file, use "
f"File({p!r})")
f"File({p!r})") from e

def exists(self):
return all([p.exists() for p in self.products])
Expand Down
2 changes: 1 addition & 1 deletion tests/products/test_metaproduct.py
Expand Up @@ -100,7 +100,7 @@ def test_error_if_metaproduct_initialized_with_non_products():
def do_stuff():
pass

with pytest.raises(TypeError) as excinfo:
with pytest.raises(AttributeError) as excinfo:
PythonCallable(do_stuff, {'a': 'not-a-product'}, dag=DAG())

assert 'Expected MetaProduct to initialize' in str(excinfo.value)
Expand Down

0 comments on commit f65a571

Please sign in to comment.