This repository was archived by the owner on May 5, 2025. It is now read-only.
Do not consider method-lines as relevant in cobertura #1170
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.
The etree API is a bit weird, because the
iter()method will iterate over matching elements in the whole subtree, instead of only over child elements. Which we actually use extensively, as we are not fully traversing the xml structure of the various formats, but just iterate over the relevant elements, regardless of their nesting.However for cobertura this might not be the right thing to do. As a
classcan havelines>line, but also aclass>methods>methodcan havelines>lineas well. We are only interested in the directly declaredlines>line, not the ones nested withinmethodshowever.Along with fixing this for the cobertura processor, this also changes some tests to use the proper class. We use the
lxmllibrary in production, but a ton of tests were using thexmllibrary, which has a mostly compatible API, but differs in some small details. For example,lxmlhas theiterchildrenmethod, whilexmldoes not.Along with changing to the proper
lxmllibrary, some tests also changed their inputs tobytes, as thelxmllibrary is otherwise throwing an error when trying to parse an xml declaration that defines anencodingfrom a pythonstr, which is utf-8 by definition.