Skip to content

Commit 1d76931

Browse files
committed
linting
1 parent eaaa70e commit 1d76931

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

.github/instructions/python-quality-checks.instructions.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,29 @@ nox --session install_python_libs
6969

7070
**Type errors in ignored files**: Legacy files in `pyproject.toml` ignore list—fix if working on them
7171

72+
## When Writing Tests
73+
74+
**Always format your test files before committing:**
75+
76+
```bash
77+
cd python_files
78+
ruff format tests/ # Format all test files
79+
# or format specific files:
80+
ruff format tests/unittestadapter/test_utils.py
81+
```
82+
83+
**Best practice workflow:**
84+
85+
1. Write your test code
86+
2. Run `ruff format` on the test files
87+
3. Run the tests to verify they pass
88+
4. Run `npm run check-python` to catch any remaining issues
89+
90+
This ensures your tests pass both functional checks and quality checks in CI.
91+
7292
## Learnings
7393

7494
- Always run `npm run check-python` before pushing to catch CI failures early (1)
7595
- Use `ruff check . --fix` to auto-fix most linting issues before manual review (1)
7696
- Pyright version must match CI (1.1.308) to avoid inconsistent results between local and CI runs (1)
97+
- Always run `ruff format` on test files after writing them to avoid formatting CI failures (1)

python_files/tests/unittestadapter/test_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ def test_doctest_patched_works() -> None:
320320

321321
# Should successfully build a tree with the patched doctest
322322
assert tests is not None
323+
323324
# The patched doctests should have proper IDs and be included
324325
# We should find at least one test child (the doctests that were patched)
325326
def count_tests(node):

python_files/unittestadapter/pvsc_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ def build_test_tree(
218218
# Check if this is a doctest with insufficient components that would cause unpacking to fail
219219
if len(components) < 3 and isinstance(test_case, doctest.DocTestCase):
220220
print(
221-
"Skipping doctest as it is not supported for the extension. Test case: ", test_case
221+
"Skipping doctest as it is not supported for the extension. Test case: ",
222+
test_case,
222223
)
223224
error = ["Skipping doctest as it is not supported for the extension."]
224225
continue

0 commit comments

Comments
 (0)