Commit 442eaac
[python] Fix test_sensitive_word failing on Windows (#10300)
## Problem
`test_sensitive_word` in `test_unbranded.py` fails on Windows CI because
the `check_sensitive_word` function uses PowerShell `Select-String`
which outputs **relative paths**, while the regex expects **absolute
paths** from `folder.as_posix()`. This causes the function to always
return `[]` on Windows.
On Linux, `grep` outputs absolute paths so the test passes.
## Fix
Replace the platform-specific shell commands (`powershell Select-String`
/ `grep`) with pure Python using `pathlib.rglob` + `read_text`. This is:
- **Cross-platform** - works identically on Windows and Linux
- **Simpler** - no shell escaping, regex parsing, or platform branching
- **Reliable** - no dependency on shell output format
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent ced6d35 commit 442eaac
2 files changed
Lines changed: 23 additions & 15 deletions
File tree
- .chronus/changes
- packages/http-client-python/tests/mock_api/unbranded
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
Lines changed: 17 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | 6 | | |
9 | 7 | | |
10 | 8 | | |
| |||
33 | 31 | | |
34 | 32 | | |
35 | 33 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
| 34 | + | |
46 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
47 | 39 | | |
48 | | - | |
49 | | - | |
50 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
| |||
0 commit comments