fix(scaffold): ship placeholder pytest file so first commit succeeds (DOT-491)#308
Conversation
|
This change is part of the following stack:
Change managed by git-spice. |
Greptile SummaryThis PR ships a placeholder pytest smoke test ( Confidence Score: 5/5Safe to merge — focused fix with no logic issues, correct All findings are P2 or lower. The template syntax follows the established pattern, the No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[copier copy / copier update] --> B{File exists in destination?}
B -- No --> C[Generate tests/__init__.py\nand test_pkg.py from template]
B -- Yes --> D[Skip — _skip_if_exists\npreserves user's real tests]
C --> E[First commit:\npytest-testmon collects test → exit 0 ✓]
D --> F[copier update safe:\nuser's tests untouched]
Reviews (3): Last reviewed commit: "fix(scaffold): ship placeholder pytest f..." | Re-trigger Greptile |
75952da to
a6387c4
Compare
4785460 to
4c241cf
Compare
4c241cf to
77fb7b7
Compare
77fb7b7 to
5ab22c6
Compare
Closes DOT-491
Summary
project/tests/__init__.pyandproject/tests/test_{{python_package_import_name}}.py.jinja— a one-line smoke test that imports the package._skip_if_existsincopier.ymlsocopier updatenever overwrites real tests once the user has written them.test_tests_directory_not_generated→test_tests_directory_has_placeholderand adjusttest_app_type_no_scaffold_codeto allow the placeholder.Why
pytest-testmonexits with code 5 when no tests are collected, which broke the very first commit on every freshly scaffolded project. Shipping a single passing test gets pytest to exit 0; the user replaces it as soon as they write real tests.Test plan
poe test— green