Skip to content

Commit 77e7053

Browse files
authored
Merge branch 'main' into parallelize-test-discovery
2 parents cbfc714 + 7b770b1 commit 77e7053

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

codeflash/discovery/discover_unit_tests.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,16 @@
1616

1717
import pytest
1818
from pydantic.dataclasses import dataclass
19+
from rich.panel import Panel
20+
from rich.text import Text
1921

2022
from codeflash.cli_cmds.console import console, logger, test_files_progress_bar
21-
from codeflash.code_utils.code_utils import custom_addopts, get_run_tmp_file, module_name_from_file_path
23+
from codeflash.code_utils.code_utils import (
24+
ImportErrorPattern,
25+
custom_addopts,
26+
get_run_tmp_file,
27+
module_name_from_file_path,
28+
)
2229
from codeflash.code_utils.compat import SAFE_SYS_EXECUTABLE, codeflash_cache_db
2330
from codeflash.models.models import CodePosition, FunctionCalledInTest, TestsInFile, TestType
2431

@@ -181,6 +188,10 @@ def discover_tests_pytest(
181188
logger.warning(
182189
f"Failed to collect tests. Pytest Exit code: {exitcode}={pytest.ExitCode(exitcode).name}\n {error_section}"
183190
)
191+
if "ModuleNotFoundError" in result.stdout:
192+
match = ImportErrorPattern.search(result.stdout).group()
193+
panel = Panel(Text.from_markup(f"⚠️ {match} ", style="bold red"), expand=False)
194+
console.print(panel)
184195

185196
elif 0 <= exitcode <= 5:
186197
logger.warning(f"Failed to collect tests. Pytest Exit code: {exitcode}={pytest.ExitCode(exitcode).name}")

0 commit comments

Comments
 (0)