List available project tests with a new "pio test --list-tests" option

This commit is contained in:
Ivan Kravets
2022-05-10 20:21:49 +03:00
parent 6d705172f5
commit e6938f8f39
7 changed files with 130 additions and 80 deletions

View File

@@ -65,6 +65,27 @@ def test_calculator_example(tmp_path: Path):
assert junit_failed_testcase.find("failure").get("message") == "Expected 32 Was 33"
def test_list_tests(clirunner, validate_cliresult, tmp_path: Path):
json_output_path = tmp_path / "report.json"
result = clirunner.invoke(
pio_test_cmd,
[
"-d",
os.path.join("examples", "unit-testing", "calculator"),
"--list-tests",
"--json-output",
str(json_output_path),
],
)
validate_cliresult(result)
# test JSON
json_report = load_json(str(json_output_path))
assert json_report["testcase_nums"] == 0
assert json_report["failure_nums"] == 0
assert json_report["skipped_nums"] == 0
assert len(json_report["test_suites"]) == 6
def test_group_and_custom_runner(clirunner, validate_cliresult, tmp_path: Path):
project_dir = tmp_path / "project"
project_dir.mkdir()