Skip to content

fix(test): 消掉 Windows cmdline 用例里的 SyntaxWarning - #41

Merged
leeguooooo merged 1 commit into
mainfrom
fix/test-invalid-escapes
Jul 26, 2026
Merged

fix(test): 消掉 Windows cmdline 用例里的 SyntaxWarning#41
leeguooooo merged 1 commit into
mainfrom
fix/test-invalid-escapes

Conversation

@leeguooooo

@leeguooooo leeguooooo commented Jul 26, 2026

Copy link
Copy Markdown
Owner

#38 合入时带进来的两条断言用了非法转义序列:

  • "C:\Python\python.exe"\P
  • "C:\Windows\explorer.exe"\W

Python 3.12+ 每次收集测试都会打 SyntaxWarning,未来版本里会直接变 SyntaxError。改成 raw string / 显式转义,断言内容和覆盖不变。

验证:compile() 扫全量 src+tests,syntax warnings 从 2 降到 0;tests/test_daemon.py 65 passed。

Summary by CodeRabbit

  • Tests
    • Updated Windows daemon-identity test fixtures to accurately reflect expected command output.
    • Corrected escaping in mocked process results to improve test reliability.

#38 带进来的两条断言里 `"C:\Python\python.exe"` / `"C:\Windows\explorer.exe"`
是非法转义序列(`\P` `\W`),Python 3.12+ 每次收集测试都报 SyntaxWarning,
未来版本会直接变成 SyntaxError。断言内容不变。
@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f8c9f85b-f380-4f67-ad51-890ff2e5e904

📥 Commits

Reviewing files that changed from the base of the PR and between 4ad3627 and bc68687.

📒 Files selected for processing (1)
  • tests/test_daemon.py

📝 Walkthrough

Walkthrough

Corrects backslash escaping in two Windows daemon-identity test fixtures so mocked subprocess output matches the expected command and executable-path strings.

Changes

Windows daemon identity tests

Layer / File(s) Summary
Correct mocked Windows command output
tests/test_daemon.py
Updates two mocked stdout literals to preserve the intended Python module path and C:\Windows\explorer.exe output.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Possibly related PRs

Suggested reviewers: celche

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the change: fixing Windows cmdline test escape warnings in daemon-related tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/test-invalid-escapes

Comment @coderabbitai help to get the list of available commands.

@leeguooooo
leeguooooo merged commit 9f70167 into main Jul 26, 2026
5 of 6 checks passed
@leeguooooo
leeguooooo deleted the fix/test-invalid-escapes branch July 26, 2026 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant