Skip to content

pytest~=4.6: UnboundLocalError: local variable 'letter' referenced before assignment #7310

@webknjaz

Description

@webknjaz

While implementing a test for pytest-dev/pytest-forked#33 I've hit this:

INTERNALERROR>   File "~/src/github/pytest-dev/pytest-forked/.tox/py27-pytest46/lib/python2.7/site-packages/_pytest/terminal.py", line 190, in pytest_report_teststatus
INTERNALERROR>     return report.outcome, letter, report.outcome.upper()
INTERNALERROR> UnboundLocalError: local variable 'letter' referenced before assignment

Looking at the repo, it seems to have been fixed on master by @nicoddemus as a part of #6337. But it still persists in the 4.6.x branch.

The fix should be trivial: just add a fallback variable value before if-blocks. No need to backport that whole PR (unless somebody thinks that it should be done, of course).

Ref: #7311.

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