Skip to content

fix: support pytest on python 3.12 wrt Fraction formatting change - #1821

Merged
hgrecco merged 1 commit into
hgrecco:masterfrom
mtasaka:py312-pytest-fix
Jul 17, 2023
Merged

fix: support pytest on python 3.12 wrt Fraction formatting change#1821
hgrecco merged 1 commit into
hgrecco:masterfrom
mtasaka:py312-pytest-fix

Conversation

@mtasaka

@mtasaka mtasaka commented Jul 17, 2023

Copy link
Copy Markdown
Contributor

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

codspeed-hq Bot commented Jul 17, 2023

Copy link
Copy Markdown

CodSpeed Performance Report

Merging #1821 will not alter performance

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

Summary

✅ 421 untouched benchmarks

@hgrecco

hgrecco commented Jul 17, 2023

Copy link
Copy Markdown
Owner

Awesome! Thanks a lot.

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

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

2 participants