GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix tests on 3.15 by AlexWaygood · Pull Request #760 · python/typing_extensions

Conversation

@AlexWaygood

@AlexWaygood AlexWaygood commented May 29, 2026

Copy link
Copy Markdown
Member

Fixes #759

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@AlexWaygood
Fix tests on 3.15
0b0262f
@codecov

codecov Bot commented May 29, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 59.45946% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.21%. Comparing base (7ce55df) to head (d6217eb).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/test_typing_extensions.py 59.45% 15 Missing ⚠️
@@            Coverage Diff             @@
##             main     #760      +/-   ##
==========================================
- Coverage   97.38%   97.21%   -0.18%     
==========================================
  Files           3        3              
  Lines        7773     7797      +24     
==========================================
+ Hits         7570     7580      +10     
- Misses        203      217      +14     
Flag Coverage Δ
3.10 88.94% <59.45%> (-0.15%) ⬇️
3.10.4 88.94% <59.45%> (-0.15%) ⬇️
3.11 88.18% <59.45%> (-0.15%) ⬇️
3.11.0 87.43% <59.45%> (-0.15%) ⬇️
3.12 88.13% <59.45%> (-0.15%) ⬇️
3.12.0 88.12% <59.45%> (-0.15%) ⬇️
3.13 82.92% <59.45%> (-0.13%) ⬇️
3.13.0 83.64% <59.45%> (-0.13%) ⬇️
3.14 79.02% <59.45%> (-0.12%) ⬇️
3.9 89.64% <59.45%> (-0.15%) ⬇️
3.9.12 89.64% <59.45%> (-0.15%) ⬇️
pypy3.10 88.77% <59.45%> (-0.15%) ⬇️
pypy3.11 88.04% <59.45%> (-0.15%) ⬇️
pypy3.9 89.48% <59.45%> (-0.15%) ⬇️

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

Files with missing lines Coverage Δ
src/typing_extensions.py 93.92% <ø> (-0.01%) ⬇️
src/test_typing_extensions.py 98.18% <59.45%> (-0.23%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

AlexWaygood
AlexWaygood commented May 29, 2026
View reviewed changes
Comment thread src/test_typing_extensions.py
self.assertIsInstance(self.sentinel_type.__doc__, str)

def test_constructor(self):
self.assertIs(self.sentinel_type, type(self.sentinel_type)())

@AlexWaygood AlexWaygood May 29, 2026

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

doesn't hold true on Python 3.15, and doesn't seem worth having a conditional test for

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/test_typing_extensions.py
Comment on lines -9542 to -9544
from test import support
with support.swap_attr(builtins, "int", dict):
self.assertIs(evaluate_forward_ref(typing.ForwardRef("int")), dict)

@AlexWaygood AlexWaygood May 29, 2026

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

uv builds of Python don't have the test module available so this test failed for me locally

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@JelleZijlstra JelleZijlstra May 29, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I just put Codex on fixing the same issue and it decided to do this instead:

@@ -9530,9 +9555,7 @@ class EvaluateForwardRefTests(BaseTestCase):
         )
         self.assertIs(evaluate_forward_ref(typing.ForwardRef("int"), globals={"int": str}), str)
         import builtins
-
-        from test import support
-        with support.swap_attr(builtins, "int", dict):
+        with patch.object(builtins, "int", dict):
             self.assertIs(evaluate_forward_ref(typing.ForwardRef("int")), dict)
 
     def test_nested_strings(self):

Seems simpler?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@AlexWaygood AlexWaygood May 29, 2026

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

oh that's nice, i forgot about patch.object

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@AlexWaygood AlexWaygood May 29, 2026

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I made that change. I wonder what benefit there is to test.support.swap_attr in the CPython test suite over just using mock.patch.object...

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/typing_extensions.py
Comment on lines -207 to -213
if repr is not None:
warnings.warn(
"The 'repr' parameter is deprecated "
"and will be removed in Python 3.15.",
DeprecationWarning,
stacklevel=2,
)

@AlexWaygood AlexWaygood May 29, 2026

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

we added the repr back upstream so I removed the deprecation (python/cpython#149654). The deprecation only exists on main, not on the latest release of typing_extensions, so this doesn't warrant a changelog entry

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/test_typing_extensions.py
Comment on lines +9685 to +9695
@skipUnless(TYPING_3_15_0, reason='Deprecated sentinel APIs are available before 3.15')
def test_sentinel_removed_deprecated_apis(self):
with self.assertRaises(TypeError):
class SentinelSubclass(Sentinel):
pass
with self.assertRaises(TypeError):
sentinel()
with self.assertRaises(TypeError):
Sentinel(name="my_sentinel")
with self.assertRaises(AttributeError):
sentinel('my_sentinel').foo = "bar"

@AlexWaygood AlexWaygood May 29, 2026

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

these all cause DeprecationWarnings in the typing_extensions backports but raise exceptions upstream on CPython. The deprecation warnings on Python <=3.14 are tested in the previous test immediately above this

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@AlexWaygood
AlexWaygood marked this pull request as ready for review May 29, 2026 13:42
JelleZijlstra
JelleZijlstra reviewed May 29, 2026
View reviewed changes
Comment thread src/test_typing_extensions.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

AlexWaygood and others added 2 commits May 29, 2026 14:50
@AlexWaygood
Update test_typing_extensions.py
82d6442
@AlexWaygood
patch
d6217eb
JelleZijlstra
JelleZijlstra approved these changes May 29, 2026
View reviewed changes
@AlexWaygood
AlexWaygood merged commit 404b33b into main May 29, 2026
22 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@AlexWaygood
AlexWaygood deleted the fix-issue-759 branch May 29, 2026 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@JelleZijlstra JelleZijlstra JelleZijlstra approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Unit tests fails on Python 3.15.0b1

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@AlexWaygood @JelleZijlstra
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.