MCPcopy Create free account
hub / github.com/FastLED/FastLED / main

Function main

ci/run_tests.py:358–552  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

356
357
358def main() -> None:
359 try:
360 args = parse_args()
361
362 # Find build directory
363 build_dir = _PROJECT_ROOT / ".build"
364 if not build_dir.exists():
365 print("Error: Build directory not found. Run compilation first.")
366 sys.exit(1)
367
368 # Discover tests
369 test_files = discover_tests(build_dir, args.test)
370 if not test_files:
371 if args.test:
372 print(f"Error: No test found matching '{args.test}'")
373 else:
374 print("Error: No tests found")
375 sys.exit(1)
376
377 print(f"Running {len(test_files)} tests...")
378 if args.test:
379 print(f"Filter: {args.test}")
380
381 # Determine number of parallel jobs
382 if os.environ.get("NO_PARALLEL"):
383 max_workers = 1
384 print(
385 "NO_PARALLEL environment variable set - forcing sequential test execution"
386 )
387 elif args.jobs:
388 max_workers = args.jobs
389 else:
390 import multiprocessing
391
392 max_workers = max(1, multiprocessing.cpu_count() - 1)
393
394 # Run tests in parallel
395 start_time = time.time()
396 results: list[TestResult] = []
397 failed_tests: list[TestResult] = []
398
399 with ThreadPoolExecutor(max_workers=max_workers) as executor:
400 future_to_test = {
401 executor.submit(
402 run_test, test_file, args.verbose, args.enable_stack_trace
403 ): test_file
404 for test_file in test_files
405 }
406
407 completed = 0
408 for future in as_completed(future_to_test):
409 test_file = future_to_test[future]
410 completed += 1
411 try:
412 result = future.result()
413 results.append(result)
414
415 # Show progress

Callers 1

run_tests.pyFile · 0.70

Calls 14

TestFailureInfoClass · 0.90
discover_testsFunction · 0.85
maxFunction · 0.85
timeMethod · 0.80
parse_argsFunction · 0.70
TestResultClass · 0.70
printFunction · 0.50
getMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected