Skip to content

Commit

Permalink
Slightly better error message for an edge case (#3442)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeauchesne authored Nov 12, 2024
1 parent 25e11c3 commit 7fa0356
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,11 @@ def pytest_pycollect_makeitem(collector, name, obj):

if collector.istestclass(obj, name):

if obj is None:
message = f"""{collector.nodeid} is not properly collected.
You may have forgotten to return a value in a decorator like @features"""
raise ValueError(message)

manifest = load_manifests()

nodeid = f"{collector.nodeid}::{name}"
Expand All @@ -235,7 +240,10 @@ def pytest_pycollect_makeitem(collector, name, obj):
declaration = manifest[nodeid]
logger.info(f"Manifest declaration found for {nodeid}: {declaration}")

released(**declaration)(obj)
try:
released(**declaration)(obj)
except Exception as e:
raise ValueError(f"Unexpected error for {nodeid}.") from e


def pytest_collection_modifyitems(session, config, items: list[pytest.Item]):
Expand Down

0 comments on commit 7fa0356

Please sign in to comment.