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

junitparser.py: Remove skipped attribute from testsuites element #101

Closed
wants to merge 1 commit into from

Conversation

carlescufi
Copy link
Contributor

@carlescufi carlescufi commented Nov 21, 2022

The presence of the "skipped" attribute in the "testsuites" element makes validation against the junit/xunit2 schemas fail. Remove it so that xml output is compliant.

See schemas: Jenkins xunit plugin or pytest, as well as the JUnit spec.

Fixes #100.

Signed-off-by: Carles Cufi carles.cufi@nordicsemi.no

@carlescufi
Copy link
Contributor Author

@weiwei FYI

@carlescufi carlescufi changed the title junitparser.py: Remove skipped attribute from testsuites junitparser.py: Remove skipped attribute from testsuites element Nov 21, 2022
@carlescufi
Copy link
Contributor Author

carlescufi commented Nov 28, 2022

@EnricoMi now that you are a co-maintainer, would you mind taking a look at this PR? 😃 Thanks!

@@ -231,7 +231,6 @@ class JUnitXml(Element):
tests: total number of tests
failures: number of failed cases
errors: number of cases with errors
skipped: number of skipped cases
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about removing this, I'll have to check some specs. At least this has to be made backward-compatible or released under a major version.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand. I linked the specs I could find in the commit message / PR description.

@EnricoMi
Copy link
Collaborator

You need

jobs:
  build-test:
    # Python version < 3.7 requires ubuntu-20.04
    runs-on: ubuntu-20.04

in .github/workflows/build.yml (see #103).

@carlescufi
Copy link
Contributor Author

You need

jobs:
  build-test:
    # Python version < 3.7 requires ubuntu-20.04
    runs-on: ubuntu-20.04

in .github/workflows/build.yml (see #103).

Do you want me to make this change in this PR, or just wait until #103 is merged and then I rebase on top of master?

@carlescufi carlescufi requested a review from EnricoMi November 29, 2022 09:24
@codecov
Copy link

codecov bot commented Nov 29, 2022

Codecov Report

Base: 98.00% // Head: 98.00% // No change to project coverage 👍

Coverage data is based on head (ffc0f74) compared to base (4326a67).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #101   +/-   ##
=======================================
  Coverage   98.00%   98.00%           
=======================================
  Files           6        6           
  Lines        1253     1253           
=======================================
  Hits         1228     1228           
  Misses         25       25           
Impacted Files Coverage Δ
junitparser/junitparser.py 99.14% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@EnricoMi
Copy link
Collaborator

EnricoMi commented Dec 9, 2022

So from all the specs that I could find it looks the right thing to remove skipped.

Ideally, you would only want it to be removed from the written XML, but still provide the skipped-sum over contained suites, if that is easily possible. Is it?

@carlescufi
Copy link
Contributor Author

So from all the specs that I could find it looks the right thing to remove skipped.

Ideally, you would only want it to be removed from the written XML, but still provide the skipped-sum over contained suites, if that is easily possible. Is it?

That's a good question. I think it might be with some refactoring, by using a class member variable instead of an Attr. I will try to take a look.

@carlescufi
Copy link
Contributor Author

carlescufi commented Dec 11, 2022

So from all the specs that I could find it looks the right thing to remove skipped.
Ideally, you would only want it to be removed from the written XML, but still provide the skipped-sum over contained suites, if that is easily possible. Is it?

That's a good question. I think it might be with some refactoring, by using a class member variable instead of an Attr. I will try to take a look.

@EnricoMi I just pushed an updated commit that hopefully does what you suggested.

Copy link
Collaborator

@EnricoMi EnricoMi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way the written XML conforms to the spec while still providing the skipped sum. This reduces risk of breaking user code, but I think it still requires a major version bump.

@carlescufi
Copy link
Contributor Author

@EnricoMi I've rebased the PR now that you've merged #103 so hopefully CI will pass now.

@carlescufi
Copy link
Contributor Author

This way the written XML conforms to the spec while still providing the skipped sum. This reduces risk of breaking user code, but I think it still requires a major version bump.

I agree with you. Is this PR plus #102 enough to justify a major version bump you think?

@weiwei
Copy link
Owner

weiwei commented Dec 22, 2022

Sorry I have been busy with family errands this month.

\The schema I referenced was this specific one, because it was the requirement of the project I was working on, and it does need the skipped attribute. I'd like to keep it supported, though I no longer work on that project it anymore.

I've been considering something like xml = JUnitXml(flavor='pytest'). This way we may be able to support different kind of schemas. What do you think? @EnricoMi and @carlescufi

@EnricoMi
Copy link
Collaborator

Excellent, I like the idea, this allows to support that varying zoo of JUnit XML schemata. And it avoids a breaking change.

@carlescufi
Copy link
Contributor Author

Excellent, I like the idea, this allows to support that varying zoo of JUnit XML schemata. And it avoids a breaking change.

Sure! I don't think I currently have the time to spend on this, but I will try to find some. If you want to go ahead and open another PR instead I will be happy to review.

@weiwei weiwei mentioned this pull request Apr 20, 2023
@weiwei
Copy link
Owner

weiwei commented May 7, 2023

Implemented in #108

@weiwei weiwei closed this May 7, 2023
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 this pull request may close these issues.

testsuites element does not validate against the xunit2 schema because of the skipped attribute
3 participants