Skip to content

Revert "[Python/Test] Work around pint TypeError - pint #1969 resolved" #1912

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mefuller
Copy link
Contributor

@mefuller mefuller commented Jun 20, 2025

This reverts commit dd03a35.

Changes proposed in this pull request

Revert commit made as workaround until pint#1969 resolved (it is resolved)

If applicable, fill in the issue number this pull request is fixing

closes #1525 (already closed, but superior)

If applicable, provide an example illustrating new features this pull request is introducing

Checklist

  • The pull request includes a clear description of this code change
  • Commit messages have short titles and reference relevant issues
  • Build passes (scons build & scons test) and unit tests address code coverage
  • Style & formatting of contributed code follows contributing guidelines
  • The pull request is ready for review

Copy link

codecov bot commented Jun 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.11%. Comparing base (305d5a1) to head (7b74033).
Report is 34 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1912      +/-   ##
==========================================
- Coverage   74.11%   74.11%   -0.01%     
==========================================
  Files         445      445              
  Lines       55454    55454              
  Branches     9121     9121              
==========================================
- Hits        41101    41098       -3     
- Misses      11262    11264       +2     
- Partials     3091     3092       +1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@speth speth left a comment

Choose a reason for hiding this comment

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

Thanks for catching that this has been resolved upstream, @mefuller. Just needs a bit of cleanup.

Comment on lines +1 to +7
from contextlib import nullcontext
from dataclasses import dataclass
from typing import Optional, Tuple, Dict
import sys

import pytest
try:
pint = pytest.importorskip("pint", "0.17.0")
except TypeError as e:
# The extra exception handling is here because pint is incompatible with
# Python 3.13. Once https://github.com/hgrecco/pint/issues/1969 is resolved the
# try/except here can be restored to just the importorskip.
pytest.skip(f"pint import failed due to {e}", allow_module_level=True)
pytest.importorskip("pint", "0.17.0")
Copy link
Member

Choose a reason for hiding this comment

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

I think this should not be a pure "revert" -- the removal of unused imports that was done in the original commit should be preserved. I also think the sense of "revert" is a bit wrong here; at least to me it implies that the original commit was erroneous, which isn't the case.

Copy link
Member

Choose a reason for hiding this comment

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

In addition to that change, I think we need to set the minimum version here as the patch that fixed this bug, otherwise there's a (admittedly small) chance that an incompatible version could be installed.

Copy link
Member

Choose a reason for hiding this comment

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

If so, that minimum version should be dependent on the Python version. For Python 3.10-3.12, whatever this new version is isn't required.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, that's a good point and complicates this somewhat, probably more than it's worth. Especially since this is just in the test suite. The place where it might make sense to add Python-version-specific Pint version ranges would be in conda and/or the wheels, since the old versions of Pint can't be updated to say they're incompatible with 3.13. Probably still not worth it, though, for this low-probability event.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make pint optional when running tests
4 participants