9393BACKGROUND_STEP_NAME = "Background"
9494
9595
96- def _is_pytest_bdd_scenario_location (location_path : str ) -> bool :
96+ def _is_pytest_bdd_scenario (location_path : str ) -> bool :
9797 """
9898 Return True if the pytest collection path points at pytest-bdd's scenario module.
9999
100100 ``Item.location[0]`` uses OS-native separators (backslashes on Windows), so a
101101 plain suffix check with ``/`` is not portable. See #418.
102102 """
103- return location_path .replace (" \\ " , "/" ).endswith ("/pytest_bdd/scenario.py" )
103+ return location_path .replace (os . path . sep , "/" ).endswith ("/pytest_bdd/scenario.py" )
104104
105105
106106def trim_docstring (docstring : str ) -> str :
@@ -917,7 +917,7 @@ def start_pytest_item(self, test_item: Optional[Item] = None):
917917 if not self .__started ():
918918 self .start ()
919919
920- if PYTEST_BDD and _is_pytest_bdd_scenario_location (test_item .location [0 ]):
920+ if PYTEST_BDD and _is_pytest_bdd_scenario (test_item .location [0 ]):
921921 self ._bdd_item_by_name [test_item .name ] = test_item
922922 return
923923
@@ -938,7 +938,7 @@ def process_results(self, test_item: Item, report):
938938 if report .longrepr :
939939 self .post_log (test_item , report .longreprtext , log_level = "ERROR" )
940940
941- if PYTEST_BDD and _is_pytest_bdd_scenario_location (test_item .location [0 ]):
941+ if PYTEST_BDD and _is_pytest_bdd_scenario (test_item .location [0 ]):
942942 return
943943
944944 leaf = self ._tree_path [test_item ][- 1 ]
@@ -1021,7 +1021,7 @@ def finish_pytest_item(self, test_item: Optional[Item] = None) -> None:
10211021 leaf = self ._tree_path [test_item ][- 1 ]
10221022 self ._process_metadata_item_finish (leaf )
10231023
1024- if PYTEST_BDD and _is_pytest_bdd_scenario_location (test_item .location [0 ]):
1024+ if PYTEST_BDD and _is_pytest_bdd_scenario (test_item .location [0 ]):
10251025 del self ._bdd_item_by_name [test_item .name ]
10261026 return
10271027
0 commit comments