#!/usr/bin/env python3 """ Fix import statements in test files """ import os import re from pathlib import Path def fix_imports_in_file(file_path): """Fix import statements in a test file""" with open(file_path, 'r', encoding='utf-8') as f: content = f.read() # Replace 'from api.' with 'from .' content = re.sub(r'from api\.', 'from .', content) content = re.sub(r'import api\.', 'import .', content) with open(file_path, 'w', encoding='utf-8') as f: f.write(content) print(f"Fixed imports in {file_path}") def main(): tests_dir = Path('tests') for test_file in tests_dir.glob('test_*.py'): fix_imports_in_file(test_file) if __name__ == '__main__': main()