Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

⚙️ Record and show test coverage contexts (what test covers which line)#11518

Merged
tiangolo merged 3 commits intofastapi:masterfrom
slafs:measure-and-show-contexts-in-coverage
Aug 16, 2024
Merged

⚙️ Record and show test coverage contexts (what test covers which line)#11518
tiangolo merged 3 commits intofastapi:masterfrom
slafs:measure-and-show-contexts-in-coverage

Conversation

@slafs
Copy link
Contributor

As documented inhttps://coverage.readthedocs.io/en/7.5.0/contexts.html#dynamic-contexts

While working on#11517 I wanted to see which test is best to modify for the fix.
One way to easily find this out is to see which line is covered by which test.

This PR adds a dynamic context setting
and makes them show on the HTML coverage report.
The contexts are test function names.

NOTE pytest-cov plugin has even better support
for pytest test names as coverage contexts,
but I think this PR is already an imporovement.

As documented inhttps://coverage.readthedocs.io/en/7.5.0/contexts.html#dynamic-contextsWhile working on#11517 I wanted to see which testis best to modify for the fix.One way to easily find this out is to see which line is coveredby which test.This PR adds a dynamic context settingand makes them show on the HTML coverage report.The contexts are test function names.NOTE pytest-cov plugin has even better supportfor pytest test names as coverage contexts,but I think this PR is already an imporovement.
"tests",
"fastapi"
]
context ='${CONTEXT}'
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Ah, not sure what this piece was for TBH 😅. Decided to remove it though.

Copy link
Member

Choose a reason for hiding this comment

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

This env var is used by/with GitHub Actions so that coverage can know where to store the coverage files, that way they can be combined later. So I think doing this trick wouldn't work. 🤔

@tiangolo
Copy link
Member

📝 Docs preview for commit84bc7c6 at:https://1ba1b8ae.fastapitiangolo.pages.dev

@tiangolotiangolo changed the titleRecord and show contexts when using coverage⚙️ Record and show test coverage contexts (what test covers which line)Aug 16, 2024
@tiangolotiangolo removed the p5 labelAug 16, 2024
@github-actions
Copy link
Contributor

📝 Docs preview for commit4d91bb0 at:https://7c1f359a.fastapitiangolo.pages.dev

@tiangolo
Copy link
Member

tiangolo commentedAug 16, 2024
edited
Loading

I was checking the docs, and it seems both contexts can be combined, so we can know which Python version and which tests ran each function. 🎉 🚀

https://coverage.readthedocs.io/en/7.6.1/contexts.html#dynamic-contexts

I updated that bit to get that. 🤓

Thank you for your contribution! 🍰

@tiangolotiangolo merged commit0aaaed5 intofastapi:masterAug 16, 2024
black-redoc pushed a commit to black-redoc/fastapi that referenced this pull requestAug 16, 2024
…e) (fastapi#11518)Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
black-redoc pushed a commit to black-redoc/fastapi that referenced this pull requestAug 17, 2024
…e) (fastapi#11518)Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
@slafsslafs deleted the measure-and-show-contexts-in-coverage branchSeptember 3, 2024 16:28
s-rigaud pushed a commit to s-rigaud/fastapi that referenced this pull requestJan 23, 2025
…e) (fastapi#11518)Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@tiangolotiangolotiangolo left review comments

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@slafs@tiangolo@alejsdev

Comments


[8]ページ先頭

©2009-2026 Movatter.jp