File tree Expand file tree Collapse file tree
tests/allure_pytest/acceptance/titlepath Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3232
3333class ParsedPytestNodeId :
3434 def __init__ (self , item : pytest .Item ):
35- filepath = item .nodeid .split ("::" , 1 )[0 ]
35+ filepath = next (
36+ (
37+ node .nodeid
38+ for node in reversed (item .listchain ())
39+ if isinstance (node , pytest .File )
40+ ),
41+ item .nodeid .split ("::" , 1 )[0 ],
42+ )
3643 self .filepath = filepath
3744 self .path_segments = filepath .split ("/" )
3845 * parent_dirs , filename = ensure_len (self .path_segments , 1 )
Original file line number Diff line number Diff line change 22from hamcrest import assert_that
33from tests .allure_pytest .pytest_runner import AllurePytestRunner
44
5+ from allure_commons_test .label import has_package
6+ from allure_commons_test .label import has_suite
57from allure_commons_test .report import has_test_case
8+ from allure_commons_test .result import has_full_name
69from allure_commons_test .result import has_title_path
710
811
@@ -73,3 +76,27 @@ def test_nested_class_method_title_path(allure_pytest_runner: AllurePytestRunner
7376 has_title_path (* path_segments , "TestBar" , "TestBaz" ),
7477 )
7578 )
79+
80+
81+ def test_file_path_with_double_colon (
82+ allure_pytest_runner : AllurePytestRunner ,
83+ ):
84+ allure_pytest_runner .pytester .makepyfile (** {
85+ "test_module::part.py" : """
86+ def test_fn():
87+ pass
88+ """
89+ })
90+
91+ allure_results = allure_pytest_runner .run_pytest ()
92+
93+ assert_that (
94+ allure_results ,
95+ has_test_case (
96+ "test_fn" ,
97+ has_full_name ("test_module::part#test_fn" ),
98+ has_title_path ("test_module::part.py" ),
99+ has_package ("test_module::part" ),
100+ has_suite ("test_module::part" ),
101+ )
102+ )
You can’t perform that action at this time.
0 commit comments