Repository navigation
Show diagnostics for failed/skipped tests run with pytest - #3303
Don Jayamanne (DonJayamanne) merged 15 commits into
Conversation
…oved commented out code
…se of the drive letter)
|
Finally figured out that when asking for the |
Don Jayamanne (DonJayamanne)
left a comment
There was a problem hiding this comment.
I've started testing this and here are some issues i've come across:
- Once a broken test is fixed, the problems do not go away, they are still displayed in the problems window.
- I quite like the way you have displayed the errors in the problems window.
Please could you try to ensure they are displayed in one line as opposed to having line breaks in there. (see here where there seems to be some line breaks) #120 (comment)
FYI:
- I merged the master with your changes and #3770
Don Jayamanne (DonJayamanne)
left a comment
There was a problem hiding this comment.
Over all a great job, minor fixes/changes.
Looking forward to merging this PR.
|
Thanks a ton for the feedback! I really appreciate it 😃
Thanks for the examples screenshots in #120! The parametrization stuff tipped me off. Turns out, it was because the name of the test itself is technically changing because the params changed. So I added a check in the
Thanks! I wasn't sure how people would feel about that, but I wanted something convenient to jump to each point in the stack trace. I ended up just stripping out anything coming after the first new line, because pytest can dive pretty deep when it describes what variables were what, and I wasn't sure where else I could put them. I was hoping there would be some title text for the diagnostic I could leave them in, but it doesn't look like VS Code supports that yet. Maybe I should make a feature request for that 🤔
I wasn't sure what to do with this info, but I appreciate it! 😄 Should I rebase there or something for this PR? |
…ssages, fixed issue with diagnostics not going away due to their name changing, and cleaned up code.
Codecov Report
@@ Coverage Diff @@
## master #3303 +/- ##
=======================================
+ Coverage 79% 79% +1%
=======================================
Files 400 402 +2
Lines 18247 18478 +231
Branches 2944 2968 +24
=======================================
+ Hits 14280 14498 +218
- Misses 3964 3977 +13
Partials 3 3
Continue to review full report at Codecov.
|
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #3303 +/- ##
=======================================
+ Coverage 79% 79% +1%
=======================================
Files 400 402 +2
Lines 18247 18478 +231
Branches 2944 2968 +24
=======================================
+ Hits 14280 14498 +218
- Misses 3964 3977 +13
Partials 3 3
Continue to review full report at Codecov.
|
For #120
package-lock.jsonhas been regenerated by runningnpm install(if dependencies have changed)Some notes:
I have it adding a
DiagnosticRelatedInformationfor each level of the traceback for tests with problems. The order of them should be dependent on the actual order of the traceback, but I believe the Problems pane doesn't preserve their order for some reason.I also have it making a
Diagnosticobject for skipped tests, but they only have a severity ofInformation.The message for the
Diagnosticobject is themessageproperty provided by by theTestFunction, prefixed with a summary of the test's status (i.e.Error/Fail/Skipped).In the event that a failed test was brought into a class by a class that was imported from another module, then the
Diagnosticwill point at the class that actually had the test which ran. This is to keep theDiagnosticpointing at something with meaningful context, so you can know what test files are actually experiencing failed tests. It even works for nested classes and nested classes inside class that are imported! It just tries to follow the chain as far down as it can within the file.I also made sure that if a test has a
Diagnosticdue to a failure/error/skip, and the test is run again, theDiagnosticwill be wiped out and then, if the test still has an issue, a newDiagnosticis added back in showing the current status and traceback of the test. This ensures that theDiagnosticis always up to date, and goes away once the test is passing.