Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 712de46

Browse files
helper__build_test_id is added (conftest refactoring) (#229)
1 parent ca54589 commit 712de46

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

tests/conftest.py

+18-12
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,22 @@ def timedelta_to_human_text(delta: datetime.timedelta) -> str:
199199
# /////////////////////////////////////////////////////////////////////////////
200200

201201

202+
def helper__build_test_id(item: pytest.Function) -> str:
203+
assert item is not None
204+
assert isinstance(item, pytest.Function)
205+
206+
testID = ""
207+
208+
if item.cls is not None:
209+
testID = item.cls.__module__ + "." + item.cls.__name__ + "::"
210+
211+
testID = testID + item.name
212+
213+
return testID
214+
215+
# /////////////////////////////////////////////////////////////////////////////
216+
217+
202218
def helper__makereport__setup(
203219
item: pytest.Function, call: pytest.CallInfo, outcome: pluggy.Result
204220
):
@@ -224,12 +240,7 @@ def helper__makereport__setup(
224240
TEST_PROCESS_STATS.incrementNotExecutedTestCount()
225241
return
226242

227-
testID = ""
228-
229-
if item.cls is not None:
230-
testID = item.cls.__module__ + "." + item.cls.__name__ + "::"
231-
232-
testID = testID + item.name
243+
testID = helper__build_test_id(item)
233244

234245
if rep.outcome == "passed":
235246
testNumber = TEST_PROCESS_STATS.incrementExecutedTestCount()
@@ -279,12 +290,7 @@ def helper__makereport__call(
279290
assert type(rep) == pytest.TestReport # noqa: E721
280291

281292
# --------
282-
testID = ""
283-
284-
if item.cls is not None:
285-
testID = item.cls.__module__ + "." + item.cls.__name__ + "::"
286-
287-
testID = testID + item.name
293+
testID = helper__build_test_id(item)
288294

289295
# --------
290296
assert call.start <= call.stop

0 commit comments

Comments
 (0)