| 31 | |
| 32 | |
| 33 | def check_test_files_have_src(): |
| 34 | unknown_test_files = [] |
| 35 | |
| 36 | excluded = [ |
| 37 | "test/mitmproxy/data/", |
| 38 | "test/mitmproxy/net/data/", |
| 39 | "/tservers.py", |
| 40 | "/conftest.py", |
| 41 | ] |
| 42 | test_files = glob.glob("test/mitmproxy/**/*.py", recursive=True) |
| 43 | test_files = [f for f in test_files if os.path.basename(f) != "__init__.py"] |
| 44 | test_files = [ |
| 45 | f for f in test_files if not any(os.path.normpath(p) in f for p in excluded) |
| 46 | ] |
| 47 | for f in test_files: |
| 48 | p = os.path.join( |
| 49 | re.sub("^test/", "", os.path.dirname(f)), |
| 50 | re.sub("^test_", "", os.path.basename(f)), |
| 51 | ) |
| 52 | if not os.path.isfile(p): |
| 53 | unknown_test_files.append((f, p)) |
| 54 | |
| 55 | return unknown_test_files |
| 56 | |
| 57 | |
| 58 | def main(): |