Skip to content

fix: make error handling consistent between plugin and archive_inspector path fallback #712

@aitestino

Description

@aitestino

Description

When relative_to() fails (test path not under test_dir), the two path computation methods behave inconsistently:

plugin.py — logs a warning with full diagnostic info:

except ValueError:
    logger.warning(
        f"Test script {testscript} (absolute: {path}) is not under test_dir "
        f"{test_dir}, using filename only"
    )
    return path.stem

archive_inspector.py — silent fallback:

except ValueError:
    return fallback_name

This creates inconsistent behavior: live test execution shows warnings in logs, but archive-extracted results silently use fallback names. Users see different test names depending on whether they're watching live progress vs reading the final report — the exact scenario the comment "mirrors the logic in the PyATS progress plugin" is supposed to prevent.

Proposed Solution

If the shared utility from #706 is implemented, both callers can add their own logging at the call site. If not, at minimum add a logger.warning() in archive_inspector.py to match plugin.py's behavior:

except ValueError:
    logger.warning(
        f"Test script {testscript} is not under test_dir {test_dir}, "
        f"falling back to: {fallback_name}"
    )
    return fallback_name

Related Issues

Context

Introduced in #655. Both methods are documented as implementing the same logic, but their error handling already diverges.

Metadata

Metadata

Assignees

No one assigned

    Labels

    code-qualityCode quality improvements and standards enforcementprio: mediumpyatsPyATS framework related

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions