Skip to content

✅ Add missing tests for code examples#1465

Merged
tiangolo merged 32 commits into
masterfrom
add-missing-tests-for-code-examples
Dec 30, 2025
Merged

✅ Add missing tests for code examples#1465
tiangolo merged 32 commits into
masterfrom
add-missing-tests-for-code-examples

Conversation

@YuriiMotov

@YuriiMotov YuriiMotov commented Dec 25, 2025

Copy link
Copy Markdown
Member

Currently, there are some missing tests for code examples:

typer/pyproject.toml

Lines 133 to 160 in da9c4c6

"docs_src/app_dir/tutorial001_py39.py", # ToDo: add test
"docs_src/arguments/optional/tutorial000_py39.py", # ToDo: add test
"docs_src/launch/tutorial001_py39.py", # ToDo: add test
"docs_src/launch/tutorial002_py39.py", # ToDo: add test
"docs_src/options/callback/tutorial002_*.py", # ToDo: add test
"docs_src/options/help/tutorial004_*.py", # ToDo: add test
"docs_src/options/password/tutorial001_*.py", # ToDo: add test
"docs_src/options/password/tutorial002_*.py", # ToDo: add test
"docs_src/options/version/tutorial001_*.py", # ToDo: add test
"docs_src/options/version/tutorial002_*.py", # ToDo: add test
"docs_src/options_autocompletion/tutorial001_*.py", # ToDo: add test
"docs_src/options_autocompletion/tutorial005_*.py", # ToDo: add test
"docs_src/options_autocompletion/tutorial006_*.py", # ToDo: add test
"docs_src/printing/tutorial001_py39.py", # ToDo: add test
"docs_src/printing/tutorial002_py39.py", # ToDo: add test
"docs_src/printing/tutorial003_py39.py", # ToDo: add test
"docs_src/printing/tutorial004_py39.py", # ToDo: add test
"docs_src/printing/tutorial005_py39.py", # ToDo: add test
"docs_src/printing/tutorial006_py39.py", # ToDo: add test
"docs_src/progressbar/tutorial001_py39.py", # ToDo: add test
"docs_src/progressbar/tutorial002_py39.py", # ToDo: add test
"docs_src/progressbar/tutorial003_py39.py", # ToDo: add test
"docs_src/progressbar/tutorial004_py39.py", # ToDo: add test
"docs_src/progressbar/tutorial005_py39.py", # ToDo: add test
"docs_src/progressbar/tutorial006_py39.py", # ToDo: add test
"docs_src/prompt/tutorial004_py39.py", # ToDo: add test
"docs_src/using_click/tutorial001_py39.py", # ToDo: add test
"docs_src/using_click/tutorial002_py39.py", # ToDo: add test

This PR adds missing tests to improve coverage

@YuriiMotov YuriiMotov added the internal Internal changes label Dec 25, 2025
@github-actions

github-actions Bot commented Dec 25, 2025

Copy link
Copy Markdown
Contributor

@YuriiMotov
YuriiMotov force-pushed the add-missing-tests-for-code-examples branch 5 times, most recently from d55a383 to 3606b3d Compare December 29, 2025 15:56
Comment thread tests/test_tutorial/test_options/test_version/test_tutorial002.py Outdated
@YuriiMotov
YuriiMotov force-pushed the add-missing-tests-for-code-examples branch from 3606b3d to 8add382 Compare December 29, 2025 18:09
@YuriiMotov
YuriiMotov marked this pull request as ready for review December 29, 2025 18:56
Comment on lines +15 to +23
@pytest.mark.xfail(
condition=((platform.system() == "Windows") and (sys.version_info < (3, 10))),
reason="On Windows with Python 3.9, output is in stdout instead of stderr",
)
def test_cli():
result = runner.invoke(app)
assert result.exit_code == 0
assert result.stdout == ""
assert "Here is something written to standard error" in result.stderr

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.

Is this a known issue?

@tiangolo 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.

Nice, thank you! 🙌

@tiangolo
tiangolo merged commit 75bf405 into master Dec 30, 2025
26 checks passed
@tiangolo
tiangolo deleted the add-missing-tests-for-code-examples branch December 30, 2025 12:21
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