MCPcopy
hub / github.com/django/django / get_label_module

Function get_label_module

tests/runtests.py:140–153  ·  view source on GitHub ↗

Return the top-level module part for a test label.

(label)

Source from the content-addressed store, hash-verified

138
139
140def get_label_module(label):
141 """Return the top-level module part for a test label."""
142 path = Path(label)
143 if len(path.parts) == 1:
144 # Interpret the label as a dotted module name.
145 return label.split(".")[0]
146
147 # Otherwise, interpret the label as a path. Check existence first to
148 # provide a better error message than relative_to() if it doesn't exist.
149 if not path.exists():
150 raise RuntimeError(f"Test label path {label} does not exist")
151 path = path.resolve()
152 rel_path = path.relative_to(RUNTESTS_DIR)
153 return rel_path.parts[0]
154
155
156def get_filtered_test_modules(start_at, start_after, gis_enabled, test_labels=None):

Callers 1

Calls 3

splitMethod · 0.45
existsMethod · 0.45
resolveMethod · 0.45

Tested by

no test coverage detected