MCPcopy Index your code
hub / github.com/python/cpython / _get_name_from_path

Method _get_name_from_path

Lib/unittest/loader.py:354–364  ·  view source on GitHub ↗
(self, path)

Source from the content-addressed store, hash-verified

352 return os.path.dirname(full_path)
353
354 def _get_name_from_path(self, path):
355 if path == self._top_level_dir:
356 return '.'
357 path = _splitext(os.path.normpath(path))
358
359 _relpath = os.path.relpath(path, self._top_level_dir)
360 assert not os.path.isabs(_relpath), "Path must be within the project"
361 assert not _relpath.startswith('..'), "Path must be within the project"
362
363 name = _relpath.replace(os.path.sep, '.')
364 return name
365
366 def _get_module_from_name(self, name):
367 __import__(name)

Callers 3

_find_testsMethod · 0.95
_find_test_pathMethod · 0.95

Calls 4

_splitextFunction · 0.70
isabsMethod · 0.45
startswithMethod · 0.45
replaceMethod · 0.45

Tested by 1