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

fix(backport): Test xml.etree.ElementTree.Element truth value by 'is not None' #2499

Conversation

meeseeksmachine
Copy link

@meeseeksmachine meeseeksmachine commented May 30, 2024

Backport PR #2459: fix: Test xml.etree.ElementTree.Element truth value by 'is not None'

* Backport PR https://github.com/scikit-hep/pyhf/pull/2459
* In Python 3.14 testing the truth value of an xml.etree.ElementTree.Element is
  deprecated and will raise an exception. As of Python 3.12 this behavior will
  raise a DeprecationWarning:

  ```
  DeprecationWarning: Testing an element's truth value will raise an exception
  in future versions.  Use specific 'len(elem)' or 'elem is not None' test
  instead.
  ```

  To avoid this, determine the truth element by using the 'elem is not None'
  method.
   - c.f. https://docs.python.org/3.12/library/xml.etree.elementtree.html#element-objects

@lumberbot-app lumberbot-app bot added tests pytest fix A bug fix labels May 30, 2024
@matthewfeickert matthewfeickert changed the title Backport PR #2459 on branch release/v0.7.x (fix: Test xml.etree.ElementTree.Element truth value by 'is not None') fix(backport): Test xml.etree.ElementTree.Element truth value by 'is not None' May 30, 2024
@matthewfeickert matthewfeickert self-assigned this May 30, 2024
@matthewfeickert matthewfeickert added the backport Backport PRs from main to release branch label May 30, 2024
Copy link

codecov bot commented May 30, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 lines in your changes are missing coverage. Please review.

Please upload report for BASE (release/v0.7.x@f9405bd). Learn more about missing BASE report.

Files Patch % Lines
src/pyhf/writexml.py 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                Coverage Diff                @@
##             release/v0.7.x    #2499   +/-   ##
=================================================
  Coverage                  ?   98.19%           
=================================================
  Files                     ?       69           
  Lines                     ?     4545           
  Branches                  ?      803           
=================================================
  Hits                      ?     4463           
  Misses                    ?       49           
  Partials                  ?       33           
Flag Coverage Δ
contrib 97.77% <0.00%> (?)
doctest 98.06% <0.00%> (?)
unittests-3.10 96.23% <0.00%> (?)
unittests-3.11 96.23% <0.00%> (?)
unittests-3.12 96.23% <0.00%> (?)
unittests-3.7 96.21% <0.00%> (?)
unittests-3.8 96.25% <0.00%> (?)
unittests-3.9 96.28% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@matthewfeickert matthewfeickert merged commit 71b87eb into scikit-hep:release/v0.7.x May 30, 2024
19 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Backport PRs from main to release branch fix A bug fix tests pytest
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants