From a089db0063a2079d8dfb023e849281f96b1df5e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20B=C5=99ezina?= Date: Wed, 31 Jan 2024 20:41:40 +0100 Subject: [PATCH] marks: put generic error message in correct scope --- pytest_mh/_private/marks.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pytest_mh/_private/marks.py b/pytest_mh/_private/marks.py index 2f3703c..6aa99c9 100644 --- a/pytest_mh/_private/marks.py +++ b/pytest_mh/_private/marks.py @@ -151,9 +151,10 @@ def Create(cls, item: pytest.Function, mark: pytest.Mark) -> TopologyMark: :raises ValueError: :rtype: TopologyMark """ + nodeid = item.parent.nodeid if item.parent is not None else "" + error = f"{nodeid}::{item.originalname}: invalid arguments for @pytest.mark.topology" + if not mark.args or len(mark.args) > 3: - nodeid = item.parent.nodeid if item.parent is not None else "" - error = f"{nodeid}::{item.originalname}: invalid arguments for @pytest.mark.topology" raise ValueError(error) # Constructor for KnownTopologyBase