GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Fix tests on 3.15 by AlexWaygood · Pull Request #760 · python/typing_extensions Conversation
Member
Fixes #759
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
There was an error while loading. Please reload this page.
Codecov Report❌ Patch coverage is
@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| self.assertIsInstance(self.sentinel_type.__doc__, str) | ||
|
|
||
| def test_constructor(self): | ||
| self.assertIs(self.sentinel_type, type(self.sentinel_type)()) |
There was a problem 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.
There was an error while loading. Please reload this page.
| from test import support | ||
| with support.swap_attr(builtins, "int", dict): | ||
| self.assertIs(evaluate_forward_ref(typing.ForwardRef("int")), dict) |
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem 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.
There was an error while loading. Please reload this page.
| if repr is not None: | ||
| warnings.warn( | ||
| "The 'repr' parameter is deprecated " | ||
| "and will be removed in Python 3.15.", | ||
| DeprecationWarning, | ||
| stacklevel=2, | ||
| ) |
There was a problem 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.
There was an error while loading. Please reload this page.
| @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" |
There was a problem 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.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Unit tests fails on Python 3.15.0b1
There was an error while loading. Please reload this page.