|
15 | 15 | from testsolar_testtool_sdk.model.load import LoadResult, LoadError |
16 | 16 | from testsolar_testtool_sdk.model.param import EntryParam |
17 | 17 | from testsolar_testtool_sdk.model.test import TestCase |
18 | | -from testsolar_testtool_sdk.reporter import Reporter |
| 18 | +from testsolar_testtool_sdk.reporter import BaseReporter, FileReporter |
19 | 19 |
|
20 | 20 | from .converter import selector_to_pytest, pytest_to_selector, CASE_DRIVE_SEPARATOR |
21 | 21 | from .filter import filter_invalid_selector_path |
|
25 | 25 |
|
26 | 26 |
|
27 | 27 | class PytestCollector: |
28 | | - def __init__(self, pipe_io: Optional[BinaryIO] = None): |
| 28 | + def __init__(self, report_file_path: Path): |
29 | 29 | self.collected: List[Item] = [] |
30 | 30 | self.errors: Dict[str, str] = {} |
31 | | - self.reporter: Reporter = Reporter(pipe_io=pipe_io) |
| 31 | + self.reporter: BaseReporter = FileReporter(report_file_path) |
32 | 32 |
|
33 | 33 | def pytest_collection_modifyitems(self, items: Sequence[Union[Item, Collector]]) -> None: |
34 | 34 | for item in items: |
@@ -105,7 +105,7 @@ def collect_testcases( |
105 | 105 |
|
106 | 106 | testcase_list = [os.path.join(entry_param.ProjectPath, it) for it in pytest_paths if it] |
107 | 107 |
|
108 | | - my_plugin = PytestCollector(pipe_io) |
| 108 | + my_plugin = PytestCollector(Path(entry_param.FileReportPath)) |
109 | 109 | args = [ |
110 | 110 | f"--rootdir={entry_param.ProjectPath}", |
111 | 111 | "--collect-only", |
@@ -150,7 +150,7 @@ def collect_testcases( |
150 | 150 | print(f"[Load] collect testcase count: {len(load_result.Tests)}") |
151 | 151 | print(f"[Load] collect load error count: {len(load_result.LoadErrors)}") |
152 | 152 |
|
153 | | - reporter = Reporter(pipe_io=pipe_io) |
| 153 | + reporter = FileReporter(Path(entry_param.FileReportPath)) |
154 | 154 | reporter.report_load_result(load_result) |
155 | 155 |
|
156 | 156 |
|
|
0 commit comments