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: support pytest on python 3.12 wrt Fraction formatting change #1821

Merged
merged 1 commit into from
Jul 17, 2023

Conversation

mtasaka
Copy link
Contributor

@mtasaka mtasaka commented Jul 17, 2023

python 3.12 supports float-style formatting for Fraction by python/cpython#100161 .
With this change, when ":n" format specifier is used in format() for Fraction type, this now raises ValueError instead of previous TypeError.

To make pytest succeed with python 3.12, make
pint.testing.assert_allclose also rescue ValueError .

Fixes #1818 .

  • Executed pre-commit run --all-files with no errors
  • The change is fully covered by automated unit tests
  • Documented in docs/ as appropriate
  • Added an entry to the CHANGES file

python 3.12 supports float-style formatting for Fraction by
python/cpython#100161 .
With this change, when ":n" format specifier is used in format() for
Fraction type, this now raises ValueError instead of previous
TypeError.

To make pytest succeed with python 3.12, make
pint.testing.assert_allclose also rescue ValueError .

Fixes hgrecco#1818 .
@codspeed-hq
Copy link

codspeed-hq bot commented Jul 17, 2023

CodSpeed Performance Report

Merging #1821 will not alter performance

Comparing mtasaka:py312-pytest-fix (2bd6677) with master (4cca8ab)

Summary

✅ 421 untouched benchmarks

@hgrecco
Copy link
Owner

hgrecco commented Jul 17, 2023

Awesome! Thanks a lot.

@hgrecco hgrecco merged commit 6c2dda9 into hgrecco:master Jul 17, 2023
33 checks passed
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.

pytest fails with python 3.12b4 possibly due to Fraction formatting change
2 participants