Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
webknjaz opened this issue Jun 3, 2020 · 3 comments

Comments

@webknjaz
Copy link
Member

webknjaz commented Jun 3, 2020

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.

webknjaz added a commit to webknjaz/pytest that referenced this issue Jun 3, 2020

Unverified

This user has not yet uploaded their public signing key.
@RonnyPfannschmidt
Copy link
Member

based on the content, i'd just backport the full pr

@webknjaz
Copy link
Member Author

webknjaz commented Jun 3, 2020

@RonnyPfannschmidt here's an alternative per your suggestion: #7314.

webknjaz added a commit to webknjaz/pytest that referenced this issue Jun 3, 2020
@asottile
Copy link
Member

asottile commented Jun 4, 2020

via #7314

@asottile asottile closed this as completed Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants