Recursively finds all Python files in the specified directory.
(dir: &str)
| 43 | |
| 44 | /// Recursively finds all Python files in the specified directory. |
| 45 | fn get_python_files(dir: &str) -> Result<Vec<String>> { |
| 46 | let mut python_files = Vec::new(); |
| 47 | for entry in fs::read_dir(dir).into_diagnostic()? { |
| 48 | let entry = entry.into_diagnostic()?; |
| 49 | let path = entry.path(); |
| 50 | |
| 51 | if path.is_dir() { |
| 52 | python_files.extend(get_python_files(path.to_str().unwrap())?); |
| 53 | } else if path.extension().and_then(|ext| ext.to_str()) == Some("py") { |
| 54 | python_files.push(path.to_str().unwrap().to_string()); |
| 55 | } |
| 56 | } |
| 57 | Ok(python_files) |
| 58 | } |
| 59 | |
| 60 | /// Runs the compatibility test on a single Python file. |
| 61 | fn run_compatibility_test(file: &str) -> Result<()> { |