Get list of changed files using git (if available).
(self)
| 73 | return "pytest" |
| 74 | |
| 75 | def get_changed_files(self) -> List[str]: |
| 76 | """Get list of changed files using git (if available).""" |
| 77 | try: |
| 78 | result = subprocess.run( |
| 79 | ["git", "diff", "--name-only", "HEAD~1"], |
| 80 | capture_output=True, text=True, timeout=5 |
| 81 | ) |
| 82 | if result.returncode == 0: |
| 83 | return [f for f in result.stdout.strip().split('\n') if f.endswith('.py')] |
| 84 | except (subprocess.TimeoutExpired, FileNotFoundError): |
| 85 | pass |
| 86 | return [] |
| 87 | |
| 88 | def map_files_to_tests(self, changed_files: List[str]) -> List[str]: |
| 89 | """Map changed source files to their corresponding test files.""" |
no test coverage detected