-
-
Notifications
You must be signed in to change notification settings - Fork 792
✅ Simplify tests for code examples, one test file for multiple variants #1664
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
✅ Simplify tests for code examples, one test file for multiple variants #1664
Conversation
…d `docs_src.tutorial.connect.select.tutorial002*`
…src.tutorial.delete.tutorial002*`
…00X` (X: 1-4) to tests variants
…_delete_relationships.tutorial003*`
…_delete_relationships.tutorial004*`
…_delete_relationships.tutorial005*`
…lationships.tutorial001*`
…lationships.tutorial002*`
…src.tutorial.select.tutorial002*`
…src.tutorial.select.tutorial004*`
…src.tutorial.update.tutorial002*`
…src.tutorial.update.tutorial004*`
|
|
||
|
|
||
| def test_run_tests(module: ModuleType): | ||
| test_path = Path(module.__file__).resolve().parent |
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.
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
tiangolo
left a comment
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.
Amazing, thank you for this! 14K lines removed! 🎉 🔥
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