Skip to content

Commit a756e56

Browse files
committed
fix the regex
1 parent 87fd97b commit a756e56

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

codeflash/optimization/optimizer.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,18 +332,20 @@ def find_leftover_instrumented_test_files(test_root: Path) -> list[Path]:
332332
"""Search for all paths within the test_root that match the following patterns.
333333
334334
- 'test.*__perf_test_{0,1}.py'
335-
- 'test_.*__unit_{0,1}.py'
335+
- 'test_.*__unit_test_{0,1}.py'
336336
- 'test_.*__perfinstrumented.py'
337337
- 'test_.*__perfonlyinstrumented.py'
338338
Returns a list of matching file paths.
339339
"""
340340
import re
341341

342342
pattern = re.compile(
343-
r"^(test.*__perf_test_?\.py|test_.*__unit_?\.py|test_.*__perfinstrumented\.py|test_.*__perfonlyinstrumented\.py)$"
343+
r"(?:test.*__perf_test_\d?\.py|test_.*__unit_test_\d?\.py|test_.*__perfinstrumented\.py|test_.*__perfonlyinstrumented\.py)$"
344344
)
345345

346-
return [file for file in test_root.rglob("test_*.py") if pattern.match(file.name)]
346+
return [
347+
file_path for file_path in test_root.rglob("*") if file_path.is_file() and pattern.match(file_path.name)
348+
]
347349

348350
def cleanup_temporary_paths(self) -> None:
349351
if self.current_function_optimizer:

0 commit comments

Comments
 (0)