[FIX] odoo_test_xmlrunner: attribute class-level errors to the right file - #3689
Closed
yajo wants to merge 15 commits into
Closed
[FIX] odoo_test_xmlrunner: attribute class-level errors to the right file#3689yajo wants to merge 15 commits into
yajo wants to merge 15 commits into
Conversation
Also implement a better patch and merge test results.
…ke sense to make this module auto installable. - As the module depends only on 'base' AND introduces a new external dependency to an extra library (unittest-xml-reporting) all the instances that are cloning server-tools repo will have trouble, because it will not be possible to install this module, due to missing dependency
This removes the new warning in 18.0
…file When setUpClass or tearDownClass fails, unittest creates an _ErrorHolder without running _XMLTestResult.startTest, so xmlrunner kept the source file of the previous test in self.filename. This made the JUnit report assign the failure to an unrelated module and left classname empty. Resolve the real test class from the _ErrorHolder description (setUpClass/tearDownClass (module.ClassName)), look up its source file and line with inspect, and patch the stored test info in addError/addFailure before the report is generated. Include a regression test that reproduces the wrong-file issue and verifies the fix. Assisted-by: OpenCode + kimi-k2.7-code
Member
Author
|
Sorry I thought the module was already in OCA. I'll add the commit to #3598 instead. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
Forward-port of the 18.0 fix for
_ErrorHolderinstances generated by failingsetUpClass/tearDownClass. Becausexmlrunner.result._XMLTestResult.startTestis never called for these holders,self.filenamekeeps the value from the previous test, so the JUnit report attributes the failure to the wrong source file and leavesclassnameempty.Fix
Parse the
_ErrorHolderdescription (setUpClass/tearDownClass (module.ClassName)), useinspectto locate the real test class, and patch the stored_TestInfoinaddError/addFailureso the generated XML points to the correct file and line.A regression test is included.
Related: #3688
Assisted-by: OpenCode + kimi-k2.7-code