Skip to content

Reports for unexpected qWarnings should show correct line number #55

Closed
@The-Compiler

Description

@The-Compiler

Currently, if I have a file like this:

96 # [...]
97
98 def test_warning():
99    qWarning("hello world")

pytest-qt shows a warning on line 97 (which is empty):

_______________________________ test_warning ________________________________
tests/utils/test_qtutils.py:97: Failure: Qt messages with level WARNING or above emitted
--------------------------- Captured Qt messages ----------------------------
QtWarningMsg: hello world

At the very least, I think the line number should be the function where the issue actually occured.

However, on Qt5 (with qInstallMessageHandler support) it'd also be possible to report the exact location in the captured log message, which would be useful.

I might submit a PR for the latter somewhen this or next week, but if you have the time, feel free to do it 😉

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions