Commit 1bd9612
testing: refine compact discovery payload review feedback (#26000)
Follow-up to #25982 addressing review feedback.
## What changed
- **Shared `isAbsolutePath` helper.** Moved the cross-platform
absolute-path check out of `testDiscoveryHandler.ts` and into
`src/client/common/platform/fs-paths.ts` so it can be reused. The
implementation now delegates to `path.posix.isAbsolute ||
path.win32.isAbsolute` instead of a hand-rolled regex. This is the right
behavior here because the paths come from a Python subprocess and may be
formatted for an OS different from the one currently running the
extension.
- **Tightened `create_class_node` annotation.** Replaced `Any` with
`pytest.Class | DescribeBlockType` in
`python_files/vscode_pytest/__init__.py`. `DescribeBlockType` is
imported inside the existing `if TYPE_CHECKING:` block so it stays
optional at runtime (matching the runtime `DescribeBlock: Any = None`
fallback when `pytest_describe` is not installed).
- **Unit tests for `isAbsolutePath`.** Added a 4-test suite in
`fs-paths.unit.test.ts` covering POSIX absolute, Windows drive-letter,
Windows UNC, and relative paths.
## Verification
- `tsc --noEmit - cleanp .`
- `eslint` on touched cleanfiles
- `ruff check vscode_ cleanpytest/`
- `pyright python_files/vscode_pytest/__init__. 0 errorspy`
- 4 new `isAbsolutePath` unit passtests
- All 17 `TestDiscoveryHandler` unit still passtests
- 3 `compact_discovery_payload` pytest passtests
## Notes for reviewers
No behavior change is intended. The new `isAbsolutePath` is functionally
equivalent to the regex it replaces (both recognize `/foo`, `C:\foo`,
`c:/foo`, and `\\server\share`). The `create_class_node` signature
change is purely a type-check improvement and has no runtime effect.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent a478402 commit 1bd9612
4 files changed
Lines changed: 42 additions & 6 deletions
File tree
- python_files/vscode_pytest
- src
- client
- common/platform
- testing/testController/common
- test/common/platform
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
873 | 874 | | |
874 | 875 | | |
875 | 876 | | |
876 | | - | |
| 877 | + | |
877 | 878 | | |
878 | 879 | | |
879 | 880 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
151 | 164 | | |
152 | 165 | | |
153 | 166 | | |
| |||
Lines changed: 1 addition & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
| 14 | + | |
18 | 15 | | |
19 | 16 | | |
20 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
0 commit comments