Skip to content

gh-112155: Run typing.py doctests during tests #112156

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

Merged
merged 4 commits into from
Nov 16, 2023

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Nov 16, 2023

After this change we can detect some hypothetical problems with doctests in typing.py.
After my change to some incorrect value doctest fails:

» ./python.exe -m test test_typing   
Using random seed: 3171999375
0:00:00 load avg: 1.44 Run 1 test sequentially
0:00:00 load avg: 1.44 [1/1] test_typing
test test_typing failed -- Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython2/Lib/doctest.py", line 2267, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for typing.get_protocol_members
  File "/Users/sobolev/Desktop/cpython2/Lib/typing.py", line 3398, in get_protocol_members

----------------------------------------------------------------------
File "/Users/sobolev/Desktop/cpython2/Lib/typing.py", line 3407, in typing.get_protocol_members
Failed example:
    get_protocol_members(P)
Expected:
    frozenset({'a', 'b', 'c'})
Got:
    frozenset({'a', 'b'})


test_typing failed (1 failure)

== Tests result: FAILURE ==

1 test failed:
    test_typing

Total duration: 253 ms
Total tests: run=601 failures=1 skipped=1
Total test files: run=1/1 failed=1
Result: FAILURE

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Nice, thanks!

@AlexWaygood AlexWaygood enabled auto-merge (squash) November 16, 2023 15:25
@AlexWaygood AlexWaygood self-assigned this Nov 16, 2023
@AlexWaygood AlexWaygood merged commit 7680da4 into python:main Nov 16, 2023
@miss-islington-app
Copy link

Thanks @sobolevn for the PR, and @AlexWaygood for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry, @sobolevn and @AlexWaygood, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 7680da458398c5a08b9c32785b1eeb7b7c0887e4 3.12

@miss-islington-app
Copy link

Sorry, @sobolevn and @AlexWaygood, I could not cleanly backport this to 3.11 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 7680da458398c5a08b9c32785b1eeb7b7c0887e4 3.11

@sobolevn
Copy link
Member Author

Will do manual backports later

@AlexWaygood
Copy link
Member

Will do manual backports later

I just realised that there are no doctests in Lib/typing.py on the 3.12 or 3.11 branches, so there's no need :)

I'll just remove the "needs backport" labels.

@AlexWaygood AlexWaygood removed needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Nov 16, 2023
@AlexWaygood
Copy link
Member

I just realised that there are no doctests in Lib/typing.py on the 3.12 or 3.11 branches, so there's no need :)

We now do, of course, following the changes made for #112194, so if you're still up for backporting this to 3.12 and 3.11, that would be great :-)

@sobolevn
Copy link
Member Author

Sure!

sobolevn added a commit to sobolevn/cpython that referenced this pull request Nov 18, 2023
@bedevere-app
Copy link

bedevere-app bot commented Nov 18, 2023

GH-112230 is a backport of this pull request to the 3.12 branch.

sobolevn added a commit to sobolevn/cpython that referenced this pull request Nov 18, 2023
@bedevere-app
Copy link

bedevere-app bot commented Nov 18, 2023

GH-112231 is a backport of this pull request to the 3.11 branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants