Visitar URL original
test(pytest): make teardown tests accept any number as name suffix · allure-framework/allure-python@5f48b72 · GitHub
Skip to content

Commit 5f48b72

Browse files
committed
test(pytest): make teardown tests accept any number as name suffix
1 parent d420cff commit 5f48b72

1 file changed

Lines changed: 34 additions & 12 deletions

File tree

‎tests/allure_pytest/acceptance/fixture/fixture_test.py‎

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import pytest
2-
from hamcrest import assert_that, not_, all_of
2+
from hamcrest import assert_that, not_, all_of, matches_regexp
33
from itertools import combinations_with_replacement
44
from tests.allure_pytest.pytest_runner import AllurePytestRunner
55

@@ -276,6 +276,10 @@ def test_with_redefined_fixture(my_fixture):
276276
conftest_literal=conftest_content
277277
)
278278

279+
import pprint
280+
281+
pprint.pprint(allure_results.test_containers)
282+
279283
assert_that(
280284
allure_results,
281285
has_test_case(
@@ -287,7 +291,7 @@ def test_with_redefined_fixture(my_fixture):
287291
has_step("Step in before in original fixture")
288292
),
289293
has_after(
290-
"my_fixture::0",
294+
matches_regexp(r"^my_fixture::\d+$"),
291295
has_step("Step in after in original fixture")
292296
)
293297
),
@@ -298,7 +302,7 @@ def test_with_redefined_fixture(my_fixture):
298302
has_step("Step in before in redefined fixture")
299303
),
300304
has_after(
301-
"my_fixture::0",
305+
matches_regexp(r"^my_fixture::\d+$"),
302306
has_step("Step in after in redefined fixture")
303307
)
304308
)
@@ -356,18 +360,24 @@ def test_three(request):
356360
has_container(
357361
allure_results,
358362
has_before("parent_auto_call_fixture"),
359-
has_after("parent_auto_call_fixture::0")
363+
has_after(
364+
matches_regexp(r"^parent_auto_call_fixture::\d$")
365+
)
360366
),
361367
has_container(
362368
allure_results,
363369
has_before("child_manual_call_fixture"),
364-
has_after("child_manual_call_fixture::0")
370+
has_after(
371+
matches_regexp(r"^child_manual_call_fixture::\d$")
372+
)
365373
),
366374
not_(
367375
has_container(
368376
allure_results,
369377
has_before("parent_dyn_call_fixture"),
370-
has_after("parent_dyn_call_fixture::0")
378+
has_after(
379+
matches_regexp(r"^parent_dyn_call_fixture::\d$")
380+
)
371381
),
372382
),
373383
not_(
@@ -382,19 +392,25 @@ def test_three(request):
382392
has_container(
383393
allure_results,
384394
has_before("parent_auto_call_fixture"),
385-
has_after("parent_auto_call_fixture::0")
395+
has_after(
396+
matches_regexp(r"^parent_auto_call_fixture::\d$")
397+
)
386398
),
387399
not_(
388400
has_container(
389401
allure_results,
390402
has_before("child_manual_call_fixture"),
391-
has_after("child_manual_call_fixture::0")
403+
has_after(
404+
matches_regexp(r"^child_manual_call_fixture::\d$")
405+
)
392406
),
393407
),
394408
has_container(
395409
allure_results,
396410
has_before("parent_dyn_call_fixture"),
397-
has_after("parent_dyn_call_fixture::0")
411+
has_after(
412+
matches_regexp(r"^parent_dyn_call_fixture::\d$")
413+
),
398414
),
399415
has_container(
400416
allure_results,
@@ -406,19 +422,25 @@ def test_three(request):
406422
has_container(
407423
allure_results,
408424
has_before("parent_auto_call_fixture"),
409-
has_after("parent_auto_call_fixture::0")
425+
has_after(
426+
matches_regexp(r"^parent_auto_call_fixture::\d$")
427+
)
410428
),
411429
not_(
412430
has_container(
413431
allure_results,
414432
has_before("child_manual_call_fixture"),
415-
has_after("child_manual_call_fixture::0")
433+
has_after(
434+
matches_regexp(r"^child_manual_call_fixture::\d$")
435+
)
416436
),
417437
),
418438
has_container(
419439
allure_results,
420440
has_before("parent_dyn_call_fixture"),
421-
has_after("parent_dyn_call_fixture::0")
441+
has_after(
442+
matches_regexp(r"^parent_dyn_call_fixture::\d$")
443+
)
422444
),
423445
not_(
424446
has_container(

0 commit comments

Comments
 (0)