MCPcopy Index your code
hub / github.com/RustPython/RustPython / findfile

Function findfile

Lib/test/support/__init__.py:703–719  ·  view source on GitHub ↗

Try to find a file on sys.path or in the test directory. If it is not found the argument passed to the function is returned (this does not necessarily signal failure; could still be the legitimate path). Setting *subdir* indicates a relative path to use to find the file rather than

(filename, subdir=None)

Source from the content-addressed store, hash-verified

701
702
703def findfile(filename, subdir=None):
704 """Try to find a file on sys.path or in the test directory. If it is not
705 found the argument passed to the function is returned (this does not
706 necessarily signal failure; could still be the legitimate path).
707
708 Setting *subdir* indicates a relative path to use to find the file
709 rather than looking directly in the path directories.
710 """
711 if os.path.isabs(filename):
712 return filename
713 if subdir is not None:
714 filename = os.path.join(subdir, filename)
715 path = [TEST_HOME_DIR] + sys.path
716 for dn in path:
717 fn = os.path.join(dn, filename)
718 if os.path.exists(fn): return fn
719 return filename
720
721
722def sortdict(dict):

Callers 15

test_sax.pyFile · 0.90
test_html_diffMethod · 0.90
test_command_usageMethod · 0.90
test_pulldom.pyFile · 0.90
test_xml_etree.pyFile · 0.90
test_xml_c14n2Method · 0.90
setUpClassMethod · 0.90
abspathFunction · 0.90
test_extract_dirMethod · 0.90
test_test_commandMethod · 0.90

Calls 2

joinMethod · 0.45
existsMethod · 0.45

Tested by 13

test_html_diffMethod · 0.72
test_command_usageMethod · 0.72
test_xml_c14n2Method · 0.72
setUpClassMethod · 0.72
abspathFunction · 0.72
test_extract_dirMethod · 0.72
test_test_commandMethod · 0.72
test_list_commandMethod · 0.72
test_extract_commandMethod · 0.72
setUpMethod · 0.72