Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TestCase.result broken when using xml.etree instead of lxml #99

Closed
carlescufi opened this issue Nov 11, 2022 · 1 comment · Fixed by #102
Closed

TestCase.result broken when using xml.etree instead of lxml #99

carlescufi opened this issue Nov 11, 2022 · 1 comment · Fixed by #102

Comments

@carlescufi
Copy link
Contributor

carlescufi commented Nov 11, 2022

This code uses lxml.etree when available, instead of xml.etree.

When lxml is not available this part of the code seems to not work correctly, so that some calls to self.remove() are not taking place when you keep doing something like:

_add_result(self, testcase, res):
    testcase.result += [res]

You end up with more results entries in testcase.result than calls to _add_result().

The workaround is just to have lxml installed: pip3 install lxml.

@carlescufi carlescufi changed the title Functionality broken when using xml.etree instead of lxml TestCase.result broken when using xml.etree instead of lxml Nov 11, 2022
carlescufi added a commit to carlescufi/zephyr that referenced this issue Nov 12, 2022
junitparser has a bug that prevents it from working correctly when lxml
is not installed.

See this GH issue for more information:
weiwei/junitparser#99

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
carlescufi added a commit to carlescufi/zephyr that referenced this issue Nov 12, 2022
See weiwei/junitparser#99.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
nashif pushed a commit to zephyrproject-rtos/zephyr that referenced this issue Nov 13, 2022
junitparser has a bug that prevents it from working correctly when lxml
is not installed.

See this GH issue for more information:
weiwei/junitparser#99

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
nashif pushed a commit to zephyrproject-rtos/zephyr that referenced this issue Nov 13, 2022
See weiwei/junitparser#99.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
coreboot-org-bot pushed a commit to coreboot/zephyr-cros that referenced this issue Nov 14, 2022
junitparser has a bug that prevents it from working correctly when lxml
is not installed.

See this GH issue for more information:
weiwei/junitparser#99

(cherry picked from commit 1951071)

Original-Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
GitOrigin-RevId: 1951071
Change-Id: Ie4b7230032fa8174fbf9a33c94271992b49f6685
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/4024974
Tested-by: Fabio Baltieri <fabiobaltieri@google.com>
Tested-by: CopyBot Service Account <copybot.service@gmail.com>
Commit-Queue: Fabio Baltieri <fabiobaltieri@google.com>
Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
coreboot-org-bot pushed a commit to coreboot/zephyr-cros that referenced this issue Nov 14, 2022
See weiwei/junitparser#99.

(cherry picked from commit 1e203ea)

Original-Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
GitOrigin-RevId: 1e203ea
Change-Id: I1b1220da79962b378f3ec6b01123e73167dd8ed6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/4024975
Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
Tested-by: Fabio Baltieri <fabiobaltieri@google.com>
Tested-by: CopyBot Service Account <copybot.service@gmail.com>
Commit-Queue: Fabio Baltieri <fabiobaltieri@google.com>
@carlescufi
Copy link
Contributor Author

@weiwei would be great to get your input on this one.

carlescufi added a commit to carlescufi/junitparser that referenced this issue Nov 22, 2022
The iteration in TestCase.result.setter did not work properly when using
xml.etree instead of lxml.etree. This was because the Element.remove()
method was being invoked while iterating the elements, and apparently
xml.etree does not support that.
Instead, use a prepopulated lits of Elements to iterate and remove.

Fixes weiwei#99.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
carlescufi added a commit to carlescufi/junitparser that referenced this issue Nov 22, 2022
This is a simple unit test to reproduce the issue described in:

weiwei#99

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
jtbaumann pushed a commit to tmobile/DevEdge-IoTDevKit-ZephyrRTOS that referenced this issue Dec 12, 2022
junitparser has a bug that prevents it from working correctly when lxml
is not installed.

See this GH issue for more information:
weiwei/junitparser#99

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
jtbaumann pushed a commit to tmobile/DevEdge-IoTDevKit-ZephyrRTOS that referenced this issue Dec 12, 2022
See weiwei/junitparser#99.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
rexut added a commit to tiacsys/bridle that referenced this issue Mar 1, 2023
The Python package junitparser has a bug that prevents it from working
correctly when lxml is not installed. See this GH issue for more
information: weiwei/junitparser#99

issues: #72

Signed-off-by: Stephan Linz <linz@li-pro.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant