FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

✅ Simplify tests for code examples, one test file for multiple variants by YuriiMotov · Pull Request #1664 · fastapi/sqlmodel · GitHub

Repository navigation

✅ Simplify tests for code examples, one test file for multiple variants - #1664

Merged
tiangolo merged 80 commits into
fastapi:mainfrom
YuriiMotov:simplify-tests-for-variants
Dec 24, 2025
Merged

tiangolo merged 80 commits into
fastapi:mainfrom
YuriiMotov:simplify-tests-for-variants

Conversation

YuriiMotov commented Dec 2, 2025 •
edited
Loading

Copy link
Copy Markdown
Member

There are no tests for variants of test_main_005 and test_main_006 in docs_src/tutorial/fastapi/app_testing/tutorial001**.
And I don't know how to add them as it seems there is no way to import fixture dynamically (so, we can only duplicate test files for each variant).

But actually we already run these tests as I explained in this comment. So, maybe we can remove all files in test_app_testing except test_tutorial001_tests_main.py. Or leave it as it is

…d `docs_src.tutorial.connect.select.tutorial002*`
YuriiMotov added the internal Internal changes label Dec 2, 2025


def test_run_tests(module: ModuleType):
test_path = Path(module.__file__).resolve().parent

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This way we run all tests inside docs_src/tutorial/fastapi/app_testing/tutorial001 and its variants:

Details

print(result.stdout.decode("utf-8"))

docs_src/tutorial/fastapi/app_testing/tutorial001/test_extra_coverage.py .....                                                                                                                                                                                                        [ 27%]
docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py .......                                                                                                                                                                                                                [ 66%]
docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_001.py .                                                                                                                                                                                                                  [ 72%]
docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_002.py .                                                                                                                                                                                                                  [ 77%]
docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_003.py .                                                                                                                                                                                                                  [ 83%]
docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_004.py .                                                                                                                                                                                                                  [ 88%]
docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_005.py .                                                                                                                                                                                                                  [ 94%]
docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_006.py .  

So, probably test_tutorial001_tests001.py ... test_tutorial001_tests006.py are redundant

YuriiMotov marked this pull request as ready for review December 3, 2025 08:26

tiangolo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Amazing, thank you for this! 14K lines removed! 🎉 🔥

tiangolo merged commit 4ea6a32 into fastapi:main Dec 24, 2025
25 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Internal changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL