jeffwright13 / pytest-fold

A Pytest plugin to make console output more manageable when there are multiple failed tests
MIT License
12 stars 2 forks source link

Figure out how to mark Pass and other non-Fail sections #10

Closed jeffwright13 closed 2 years ago

jeffwright13 commented 2 years ago

Current code only marks failures, which is great for probably 80% of the time, but the user should have access to the full output of the test run.

Code implementing failure-case marking is in plugin.py, in hook pytest_runtest_logreport. The current implementation of accessing the report.longrepr.chain[0][0].reprentries[0].lines.insert(0, MARKERS["pytest_fold_failure_begin"]) fails with error

INTERNALERROR>   File "/Users/jwr003/coding/pytest-fold/pytest_fold/plugin.py", line 139, in pytest_runtest_logreport
INTERNALERROR>     report.longrepr.chain[0][0].reprentries[0].lines.insert(0, pytest_pass_1)
INTERNALERROR> AttributeError: 'NoneType' object has no attribute 'chain'
jeffwright13 commented 2 years ago

Implementation in latest issue10 branch collects PASS/SKIP tests as the test's TestReport is being gathered; then adds them to a list (which is pickled to disk for later retrieval). Rudimentary implementation does in deed show Pass tests.