MCPcopy
hub / github.com/RasaHQ/rasa / _get_marker_for_ci_matrix

Function _get_marker_for_ci_matrix

tests/conftest.py:759–787  ·  view source on GitHub ↗

Returns pytest marker which is used to parallelize the tests in GitHub actions. Args: item: The test case. Returns: A marker for this test based on which directory / python module the test is in.

(item: Function)

Source from the content-addressed store, hash-verified

757
758
759def _get_marker_for_ci_matrix(item: Function) -> Text:
760 """Returns pytest marker which is used to parallelize the tests in GitHub actions.
761
762 Args:
763 item: The test case.
764
765 Returns:
766 A marker for this test based on which directory / python module the test is in.
767 """
768 test_path = Path(item.fspath).absolute()
769
770 matching_markers = [
771 marker
772 for marker, paths_for_marker in PATH_PYTEST_MARKER_MAPPINGS.items()
773 if any(
774 path == test_path or path in test_path.parents for path in paths_for_marker
775 )
776 ]
777
778 if not matching_markers:
779 return "category_other_unit_tests"
780 if len(matching_markers) > 1:
781 raise ValueError(
782 f"Each test should only be in one category. Test '{item.name}' is assigned "
783 f"to these categories: {matching_markers}. Please fix the "
784 "mapping in `PATH_PYTEST_MARKER_MAPPINGS`."
785 )
786
787 return matching_markers[0]
788
789
790def pytest_collection_modifyitems(items: List[Function]) -> None:

Callers 1

Calls 1

itemsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…