Compare commits

..

1 Commits

Author SHA1 Message Date
ad1d474aee fix: 3 syntax errors in perf_bottleneck_finder.py (#211)
Some checks failed
Test / pytest (pull_request) Failing after 16s
1. Line 116: regex pattern had broken quote escaping
2. Lines 509-510: return statement split across two lines
3. Line 524: global declaration after first use
2026-04-21 11:20:05 +00:00

View File

@@ -113,7 +113,7 @@ def find_slow_tests_by_scan(repo_path: str) -> List[Bottleneck]:
(r"time\.sleep\((\d+(?:\.\d+)?)\)", "Contains time.sleep() — consider using mock or async wait"),
(r"subprocess\.run\(.*timeout=(\d+)", "Subprocess with timeout — may block test"),
(r"requests\.(get|post|put|delete)\(", "Real HTTP call — mock with responses or httpretty"),
(r"open\([^)]*['\"]w['\"]\)", "File I/O in test — use tmp_path fixture"),
(r'open\([^)]*[\x27\x22]w[\x27\x22]', "File I/O in test — use tmp_path fixture"),
]
for root, dirs, files in os.walk(repo_path):
@@ -509,10 +509,10 @@ def format_markdown(report: PerfReport) -> str:
return "\n".join(lines)
# ── Main ───────────────────────────────────────────────────────────
def main():
global SLOW_TEST_THRESHOLD_S
parser = argparse.ArgumentParser(description="Performance Bottleneck Finder")
parser.add_argument("--repo", default=".", help="Path to repository to analyze")
parser.add_argument("--json", action="store_true", help="Output as JSON")
@@ -521,6 +521,7 @@ def main():
help="Slow test threshold in seconds")
args = parser.parse_args()
# SLOW_TEST_THRESHOLD_S is module-level
SLOW_TEST_THRESHOLD_S = args.threshold
if not os.path.isdir(args.repo):