MCPcopy
hub / github.com/numpy/numpy / main

Function main

tools/check_installed_files.py:37–74  ·  view source on GitHub ↗
(install_dir, tests_check)

Source from the content-addressed store, hash-verified

35
36
37def main(install_dir, tests_check):
38 INSTALLED_DIR = os.path.join(ROOT_DIR, install_dir)
39 if not os.path.exists(INSTALLED_DIR):
40 raise ValueError(
41 f"Provided install dir {INSTALLED_DIR} does not exist"
42 )
43
44 numpy_test_files = get_files(NUMPY_DIR, kind='test')
45 installed_test_files = get_files(INSTALLED_DIR, kind='test')
46
47 if tests_check == "--no-tests":
48 if len(installed_test_files) > 0:
49 raise Exception("Test files aren't expected to be installed in "
50 f"{INSTALLED_DIR}, found {installed_test_files}")
51 print("----------- No test files were installed --------------")
52 else:
53 # Check test files detected in repo are installed
54 for test_file in numpy_test_files.keys():
55 if test_file not in installed_test_files.keys():
56 raise Exception(
57 f"{numpy_test_files[test_file]} is not installed"
58 )
59
60 print("----------- All the test files were installed --------------")
61
62 numpy_pyi_files = get_files(NUMPY_DIR, kind='stub')
63 installed_pyi_files = get_files(INSTALLED_DIR, kind='stub')
64
65 # Check *.pyi files detected in repo are installed
66 for pyi_file in numpy_pyi_files.keys():
67 if pyi_file not in installed_pyi_files.keys():
68 if (tests_check == "--no-tests" and
69 "tests" in numpy_pyi_files[pyi_file]):
70 continue
71 raise Exception(f"{numpy_pyi_files[pyi_file]} is not installed")
72
73 print("----------- All the necessary .pyi files "
74 "were installed --------------")
75
76
77def get_files(dir_to_check, kind='test'):

Callers 1

Calls 4

get_filesFunction · 0.85
joinMethod · 0.80
existsMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…