pytest-dev / pytest-dev/pytest
Bug: Traceback cleanup fails on Exception/pytest.fail in Item.runtest
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 14.5k
- Forks
- 3.4k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 35
Description
- a detailed description of the bug or suggestion
- output of
pip listfrom the virtual environment you are using - pytest and operating system versions
- minimal example if possible
- Not strictly minimal, but I'll see if I can minimize it sometime this week.
I have a small plugin that dynamically generates tests based on some custom boilerplate. These tests have the following form [0]:
# In Item subclass
def runtest(self):
assert self.function(*self.args, **self.kwargs)
One such test happens to fail, with the following traceback: [1]. pytest.fail also results in similar output. Clearly, something went wrong – even frames with __tracebackhide__ are getting shown.
pip list
Package Version Location
------------------- ----------------------- ------------------------------------------------------------
appdirs 1.4.4
attrs 20.1.0
black 19.10b1.dev141+g820f387 <snip>/.venv/src/black/src
cfgv 3.2.0
click 7.1.2
distlib 0.3.1
docutils 0.16
filelock 3.0.12
flake8 3.8.3
flake8-bugbear 20.1.4
flake8-plugin-utils 1.3.1
flake8-pytest-style 1.2.3
hypothesis 5.28.0
identify 1.4.28
iniconfig 1.0.1
isort 5.4.2
mccabe 0.6.1
more-itertools 8.4.0
mypy 0.782
mypy-extensions 0.4.3
nodeenv 1.5.0
packaging 20.4
pathspec 0.8.0
pip 20.1.1
pluggy 0.13.1
ppcg 0.0.0 <snip>/src
pre-commit 2.7.1
py 1.9.0
pycodestyle 2.6.0
pyflakes 2.2.0
Pygments 2.6.1
pyparsing 2.4.7
pyperclip 1.8.0
pyroma 2.6
pytest 6.0.1
PyYAML 5.3.1
regex 2020.7.14
setuptools 47.1.0
six 1.15.0
sortedcontainers 2.2.2
toml 0.10.1
typed-ast 1.4.1
typing-extensions 3.7.4.3
virtualenv 20.0.31
vulture 1.5
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Item subclass runtest example in the linked ppcg plugin and review the linked traceback, using the reported pytest 6.0.1 environment as context. Investigate why traceback cleanup exposes frames marked with tracebackhide for Exception and pytest.fail; done means those frames are hidden in both cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100