INNER CODE UNIT · Python

validate_project_coverage

alper-han/CrossMacro · scripts/ci/run-tests.py:62

def validate_project_coverage(root):
    configured = {Path(arg).resolve() for platform in ("Linux", "Windows", "MacOS")
                  for command, _ in test_commands(platform, root)
                  for arg in command if arg.endswith(".csproj")}
    actual = {path.resolve() for path in (root / "tests").glob("**/*.Tests.csproj")}
    if configured != actual:
        missing = sorted(path.name for path in actual - configured)
        stale = sorted(path.name for path in configured - actual)
        raise ValueError(f"Test project coverage mismatch; unconfigured: {missing}; missing projects: {stale}")


def read_results(path):
    document = ET.parse(path)
    counters = document.find(".//{*}ResultSummary/{*}Counters")
    if counters is None:
        raise ValueError("TRX has no test counters")
    values = {name: int(counters.attrib[name]) for name in ("total", "executed", "passed", "failed", "notExecuted")}
    # VSTest/xUnit may leave Counters.notExecuted at zero for skipped facts.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…