-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d8f54fa
commit 290d271
Showing
6 changed files
with
50 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from typing import Optional | ||
|
||
from trunner.ctx import TestContext | ||
from trunner.dut import HostDut | ||
from trunner.types import Status, TestResult | ||
|
||
def pytest_harness(dut: HostDut, ctx: TestContext, result: TestResult, **kwargs) -> Optional[TestResult]: | ||
Check failure on line 7 in trunner/harness/pytest.py GitHub Actions / build (3.11)
Check failure on line 7 in trunner/harness/pytest.py GitHub Actions / build (3.9)
|
||
test_re = r"\:\:(?P<group>.+)\:\:(?P<name>.+)(?P<status>PASSED|SKIPPED|FAILED|ERROR)" | ||
final_re = r"\[100\%\]" | ||
|
||
status = Status.OK | ||
|
||
test_path = kwargs.get("path") | ||
cmd = f"pytest -v --tb=no {test_path}" | ||
|
||
dut.set_args(cmd, encoding="utf-8") | ||
dut.open() | ||
|
||
while True: | ||
idx = dut.expect([test_re, final_re], timeout=200) | ||
parsed = dut.match.groupdict() | ||
|
||
if idx == 0: | ||
sub_status = Status.from_str(parsed["status"]) | ||
if sub_status is Status.FAIL: | ||
status = sub_status | ||
subname = f"{parsed['name']}" | ||
Check warning on line 27 in trunner/harness/pytest.py GitHub Actions / build (3.11)
Check warning on line 27 in trunner/harness/pytest.py GitHub Actions / build (3.9)
|
||
# result.add_subresult(subname, sub_status) | ||
continue | ||
|
||
elif idx == 1: | ||
break | ||
|
||
|
||
return TestResult(status=status, msg="") | ||
Check failure on line 35 in trunner/harness/pytest.py GitHub Actions / build (3.11)
Check failure on line 35 in trunner/harness/pytest.py GitHub Actions / build (3.9)
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters