You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Use pytest hooks for test execution instead of "scraping" the JUnit XML results. #12973
Couldn't find an open issue, if we have one feel free to close this one against it
Note we already use hooks for test discovery, this issue for test execution. The output on executing tests is not stable, so the assumptions we make when scraping output can break things. (For eg. #12403, pytest-dev/pytest#7463, #7265)
I had initially encountered a very particular place where I found the code was scraping the testFunction.testFunction.traceback to figure out the test filePath:
And secondly, yes, I saw what goes in TestRunner.run() and saw we execute module pytest. We collect results in a JUnit XML file, which is then parsed here:
We don't scrape terminal output so it's not as bad, but JUnit XML format can change as well, happened once to us here: #6990 and broke running tests for everybody.
changed the title [-]Use pytest hooks for test execution instead of scraping the output[/-][+]Use pytest hooks for test execution instead of "scraping" the JUnit XML results.[/+]on Aug 28, 2020
One can use the pytest_runtest_logreport hook to capture result of each stage ("setup", "teardown" ,"call") it includes a TestReport object that holds the outcome of the test and other data such as captured logs and test duration
Activity
DonJayamanne commentedon Jul 15, 2020
Here you go #1132
I thought we are doing that today
karrtikr commentedon Jul 15, 2020
Don Jayamanne (@DonJayamanne) This one is for execution, not discovery. We already do that for discovery.
luabud commentedon Aug 26, 2020
Kartik Raj (@karrtikr) I believe we don't scrape out the output from execution, do we?
cc Eric Snow (@ericsnowcurrently)
karrtikr commentedon Aug 27, 2020
We do scrape out the output from execution, which is something we probably shouldn't.
ericsnowcurrently commentedon Aug 27, 2020
Are you talking about what goes on in
TestRunner.run()and it's use ofexecObservable()?perhaps particularly relevant:
vscode-python/src/client/testing/common/runner.ts
Lines 75 to 103 in c37c79d
Regardless, it sounds like you have specific code in mind. Where is it?
karrtikr commentedon Aug 27, 2020
I had initially encountered a very particular place where I found the code was scraping the
testFunction.testFunction.tracebackto figure out the test filePath:vscode-python/src/client/testing/pytest/services/testMessageService.ts
Lines 90 to 97 in a98be63
And secondly, yes, I saw what goes in
TestRunner.run()and saw we execute module pytest. We collect results in a JUnit XML file, which is then parsed here:vscode-python/src/client/testing/common/xUnitParser.ts
Lines 82 to 100 in 61b179b
We don't scrape terminal output so it's not as bad, but JUnit XML format can change as well, happened once to us here: #6990 and broke running tests for everybody.
[-]Use pytest hooks for test execution instead of scraping the output[/-][+]Use pytest hooks for test execution instead of "scraping" the JUnit XML results.[/+]nadavmisgav commentedon Sep 26, 2020
Is any one working on this? This also help to show test result when it ends and not wait for all tests to finish, right?
karrtikr commentedon Sep 28, 2020
If the pytest hooks provide that feature, then yes, but I'm not aware if they do.
nadavmisgav commentedon Sep 28, 2020
One can use the pytest_runtest_logreport hook to capture result of each stage ("setup", "teardown" ,"call") it includes a TestReport object that holds the outcome of the test and other data such as captured logs and test duration
karrtikr commentedon Dec 21, 2022
Eleanor Boyd (@eleanorjboyd) Are we still scraping test outputs for execution?
eleanorjboyd commentedon Dec 21, 2022
Yes still scraping output, this will be fixed in the rewrite. I will reference this in the meta issue I am tracking here.
eleanorjboyd commentedon Jul 14, 2023
closing since this is fixed by the testing rewrite, thanks