Skip to content

Summary report should report failed tests using {file}:{line} format instead of {file}::{test_name} #8850

Open
@ssbarnea

Description

@ssbarnea

In order to assure that the reader can easily go directly to the failed line by clicking inside the terminal we need to ensure that the output follows the format {file}:{line} ... (space after line number). This format ensures that terminal can linkify the output and open the editor at expected lines.

At this moment the editors open only the correct file, but not at desired line.

Current output:

========================================================= short test summary info =========================================================
FAILED src/test/unit/test_collections.py::test_default_options_property - AssertionError: assert {'co...

Desired output:

========================================================= short test summary info =========================================================
FAILED src/test/unit/test_collections.py:123:test_default_options_property - AssertionError: assert {'co...

One of the problems with current proposal is that current output format {file}::{test} is used as test-selector, so if we change it it will be harder to copy/paste failed test selector and run pytest only for that test.

Does anyone have an idea about how we can allow both use cases?

Based on my testing displaying something like {file}:{line}:{test_name} seems to work correctly with iterm+vscode but not with vscode own terminal, but that is due to a known bug I reported recently. I expect them to fix it soon.

This brings me back to the idea that maybe using {file}:{line}:{test_name} may prove useful as long we ensure that running pytest -k file::test still works, mainly we would likely need to ignore line numbers when using expressions.

WDYT?

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: reportingrelated to terminal output and user-facing messages and errorstopic: selectionrelated to test selection from the command linetype: enhancementnew feature or API change, should be merged into features branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions