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 — Add `durations` to `unittest` in 3.12 by sobolevn · Pull Request #10636 · python/typeshed

Conversation

@sobolevn

@sobolevn sobolevn commented Aug 30, 2023

Copy link
Copy Markdown
Member

Source commit: python/cpython@6883007

Sorry, something went wrong.

Uh oh!

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

All reactions
sobolevn and others added 3 commits August 30, 2023 10:24
@sobolevn
Add durations to unittest in 3.12
3e08f92
@pre-commit-ci
[pre-commit.ci] auto fixes from pre-commit.com hooks
b011b95
@sobolevn
Typo
f3f9767
@github-actions

This comment has been minimized.

Sign in to view
srittau
srittau reviewed Aug 30, 2023
View reviewed changes
Comment thread stdlib/unittest/result.pyi Outdated
from typing_extensions import TypeAlias

_F = TypeVar("_F", bound=Callable[..., Any])
_DurationsType: TypeAlias = list[tuple[unittest.case.TestCase, float]]

@srittau srittau Aug 30, 2023

Copy link
Copy Markdown
Collaborator

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.

At least collectedDurations (ugh, camel case...) uses list[tuple[str, float]]:

https://github.com/python/cpython/blob/24b9bdd6eaf0b04667b6cd4c8154f7c7c10c2398/Lib/unittest/result.py#L170

Sorry, something went wrong.

Uh oh!

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

All reactions

@srittau srittau Aug 30, 2023

Copy link
Copy Markdown
Collaborator

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.

Although the docs are wrong: https://docs.python.org/3.12/library/unittest.html?highlight=collecteddurations#unittest.TestResult.collectedDurations

But even the tests use str: https://github.com/python/cpython/blob/24b9bdd6eaf0b04667b6cd4c8154f7c7c10c2398/Lib/test/test_unittest/test_runner.py#L1402

I will send a PR to CPython.

Sorry, something went wrong.

Uh oh!

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

All reactions

@sobolevn sobolevn Aug 30, 2023

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.

Yeap, I used docs for this type. Let's wait for your PR to land first.

Sorry, something went wrong.

Uh oh!

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

All reactions

@srittau srittau Aug 30, 2023

Copy link
Copy Markdown
Collaborator

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.

Looks like a deliberate change to fix a circular reference, they just forgot to update the docs: python/cpython#106888

Sorry, something went wrong.

Uh oh!

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

All reactions
@srittau srittau mentioned this pull request Aug 30, 2023
Documentation for TestResult.collectedDurations is outdated python/cpython#108669
Closed
@sobolevn
Address review
09bca56
srittau
srittau approved these changes Aug 30, 2023
View reviewed changes

@srittau srittau left a comment

Copy link
Copy Markdown
Collaborator

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.

Thanks!

Sorry, something went wrong.

Uh oh!

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

All reactions
@github-actions

This comment has been minimized.

Sign in to view
AlexWaygood
AlexWaygood reviewed Aug 30, 2023
View reviewed changes
Comment thread stdlib/unittest/runner.pyi Resolved

Uh oh!

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

Comment thread stdlib/unittest/runner.pyi Resolved

Uh oh!

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

sobolevn added 2 commits August 30, 2023 13:22
@sobolevn
Address review
319e555
@sobolevn
Address review
b6e4128
AlexWaygood
AlexWaygood approved these changes Aug 30, 2023
View reviewed changes

@AlexWaygood AlexWaygood left a comment

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.

Thanks!

Sorry, something went wrong.

Uh oh!

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

All reactions
@pre-commit-ci
[pre-commit.ci] auto fixes from pre-commit.com hooks
395318a
@github-actions

github-actions Bot commented Aug 30, 2023

Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

tornado (https://github.com/tornadoweb/tornado)
+ tornado/test/runtests.py:72: error: Unused "type: ignore" comment  [unused-ignore]
+ tornado/test/runtests.py:78: error: Unused "type: ignore" comment  [unused-ignore]
All reactions

Sorry, something went wrong.

Uh oh!

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

@AlexWaygood
AlexWaygood merged commit c9583d9 into main Aug 30, 2023
@AlexWaygood
AlexWaygood deleted the py312-unittest branch August 30, 2023 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@srittau srittau srittau approved these changes
@AlexWaygood AlexWaygood AlexWaygood 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.

Uh oh!

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

3 participants

@sobolevn @srittau @AlexWaygood
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.