Spaces:
Running
Running
| import os | |
| import re | |
| def discover_tests(): | |
| print("\n=== TEST STATUS ===") | |
| test_files = [] | |
| for root, dirs, files in os.walk('.'): | |
| dirs[:] = [d for d in dirs if d not in {'node_modules', '__pycache__', '.git'}] | |
| for f in files: | |
| if f.startswith('test_') and f.endswith('.py'): | |
| full = os.path.join(root, f) | |
| try: | |
| content = open(full, errors='ignore').read() | |
| tests = len(re.findall(r'def test_', content)) | |
| lines = sum(1 for _ in open(full, errors='ignore')) | |
| test_files.append((full, tests, lines)) | |
| except: pass | |
| for path, tests, lines in sorted(test_files): | |
| print(f" {tests:>3} tests | {lines:>5} lines | {path}") | |
| def discover_frontend(): | |
| print("\n=== FRONTEND STATUS ===") | |
| src_paths = ['frontend/src', 'senti/senti-web/src', 'src'] | |
| for src in src_paths: | |
| if not os.path.exists(src): continue | |
| print(f" Path: {src}") | |
| files = [] | |
| for root, dirs, fs in os.walk(src): | |
| dirs[:] = [d for d in dirs if d != 'node_modules'] | |
| for f in fs: | |
| if f.endswith(('.jsx', '.js', '.tsx', '.ts')): | |
| full = os.path.join(root, f) | |
| try: | |
| lines = sum(1 for _ in open(full, errors='ignore')) | |
| files.append((os.path.relpath(full, src), lines)) | |
| except: pass | |
| print(f" Total Files: {len(files)} | Total Lines: {sum(l for _, l in files):,}") | |
| for rel, lines in sorted(files, key=lambda x: -x[1])[:10]: | |
| print(f" {lines:>5} {rel}") | |
| break | |
| if __name__ == "__main__": | |
| discover_tests() | |
| discover_frontend() | |