Create example test file when adding pytest, with --no-example opt-out#1723
Merged
nathanjmcdougall merged 6 commits intomainfrom Apr 1, 2026
Merged
Create example test file when adding pytest, with --no-example opt-out#1723nathanjmcdougall merged 6 commits intomainfrom
nathanjmcdougall merged 6 commits intomainfrom
Conversation
Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/e062ac57-18e3-4222-bf8d-f97799827cc3 Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/e062ac57-18e3-4222-bf8d-f97799827cc3 Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add dummy test file for pytest
Create example test file when adding pytest, with --no-example opt-out
Apr 1, 2026
nathanjmcdougall
requested changes
Apr 1, 2026
Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/8a039de5-81a3-4d98-8447-0d0e783859d9 Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
nathanjmcdougall
approved these changes
Apr 1, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
nathanjmcdougall
approved these changes
Apr 1, 2026
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
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.
Running
pytestimmediately afterusethis tool pytestfails because the tests directory has no test files. This adds atests/test_example.pywith a trivial passing test so pytest works out of the box.Changes
_integrations/pytest/core.py— Addedadd_example_test()to create the example file; updatedremove_pytest_dir()to treattest_example.pyas a managed file (auto-cleaned on removal)_core/tool.py—use_pytest()acceptsexample: bool = Trueand callsadd_example_test()when enabled--example/--no-exampleoption wired throughusethis tool pytestandusethis testcommands_toolset/test.py— Threadedexampleparam throughuse_test_frameworks()TestAddExampleTest(content, message, idempotency), roundtrip/cleanup tests forremove_pytest_dirwith example file,test_no_exampleat both core and CLI layers, plustest_conftest_already_existsfor 100% module coverage