(
src_dir, patterns, target_dir, start_with=None, do_verify=False, max_files=200
)
| 102 | |
| 103 | |
| 104 | def do_tests( |
| 105 | src_dir, patterns, target_dir, start_with=None, do_verify=False, max_files=200 |
| 106 | ): |
| 107 | def visitor(files, dirname, names): |
| 108 | files.extend( |
| 109 | [ |
| 110 | os.path.normpath(os.path.join(dirname, n)) |
| 111 | for n in names |
| 112 | for pat in patterns |
| 113 | if fnmatch(n, pat) |
| 114 | ] |
| 115 | ) |
| 116 | |
| 117 | files = [] |
| 118 | cwd = os.getcwd() |
| 119 | os.chdir(src_dir) |
| 120 | for root, dirname, names in os.walk(os.curdir): |
| 121 | files.extend( |
| 122 | [ |
| 123 | os.path.normpath(os.path.join(root, n)) |
| 124 | for n in names |
| 125 | for pat in patterns |
| 126 | if fnmatch(n, pat) |
| 127 | ] |
| 128 | ) |
| 129 | pass |
| 130 | os.chdir(cwd) |
| 131 | files.sort() |
| 132 | |
| 133 | if start_with: |
| 134 | try: |
| 135 | start_with = files.index(start_with) |
| 136 | files = files[start_with:] |
| 137 | print(">>> starting with file", files[0]) |
| 138 | except ValueError: |
| 139 | pass |
| 140 | |
| 141 | if len(files) > max_files: |
| 142 | files = [ |
| 143 | file |
| 144 | for file in files |
| 145 | if not "site-packages" in file |
| 146 | and (file.endswith(".pyo") or file.endswith(".pyc")) |
| 147 | ] |
| 148 | files = [ |
| 149 | file |
| 150 | for file in files |
| 151 | if not "test" in file and (file.endswith(".pyo") or file.endswith(".pyc")) |
| 152 | ] |
| 153 | if len(files) > max_files: |
| 154 | # print("Number of files %d - truncating to last 200" % len(files)) |
| 155 | print( |
| 156 | "Number of files %d - truncating to first %s" % (len(files), max_files) |
| 157 | ) |
| 158 | files = files[:max_files] |
| 159 | |
| 160 | print(time.ctime()) |
| 161 | (tot_files, okay_files, failed_files, verify_failed_files) = main.main( |
no test coverage detected