Closed Bug 1342954 Opened 3 years ago Closed 3 years ago

Improve handling of ERROR in pytest-mozlog

Categories

(Testing :: Mozbase, defect)

defect
Not set

Tracking

(firefox54 fixed)

RESOLVED FIXED
mozilla54
Tracking Status
firefox54 --- fixed

People

(Reporter: jgraham, Unassigned)

Details

Attachments

(2 files)

The assumption that report.longrepr is a string or a tuple or has a reprcrash attribute is not quite true e.g. sometimes one gets an errorstring attribute. We should handle this better.
Comment on attachment 8841610 [details]
Bug 1342954 - Improve ERROR handling in pytest_mozlog

https://reviewboard.mozilla.org/r/115762/#review117174

::: testing/mozbase/mozlog/mozlog/pytest_mozlog/plugin.py:100
(Diff revision 1)
> -                    # For failures, longrepr is a ReprExceptionInfo
> +                # For failures, longrepr is a ReprExceptionInfo
> -                    crash = report.longrepr.reprcrash
> +                crash = longrepr.reprcrash
> -                    message = "{0} (line {1})".format(crash.message, crash.lineno)
> +                message = "{0} (line {1})".format(crash.message, crash.lineno)
> -                    stack = report.longrepr.reprtraceback
> -                except AttributeError:
> +                stack = longrepr.reprtraceback
> +            elif hasattr(longrepr, "errorstring"):
> +                message = longrepr.errorstring

Here, stack will be None. When longrepr is a string I set stack to match message, but I'm not sure if that's the right thing to do.
Attachment #8841610 - Flags: review?(dave.hunt) → review+
Pushed by james@hoppipolla.co.uk:
https://hg.mozilla.org/integration/autoland/rev/1890ccdab48d
Improve ERROR handling in pytest_mozlog r=davehunt
Attached patch 1342954.diffSplinter Review
Fix flake8 bustage
Attachment #8841971 - Flags: checked-in+
Attachment #8841971 - Flags: checked-in+
Keywords: checkin-needed
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/86de81c342fd
fixup formatting to keep flake8 happy, a=bustage
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/1890ccdab48d
https://hg.mozilla.org/mozilla-central/rev/86de81c342fd
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
You need to log in before you can comment on or make changes to this bug.