Conversation
There was a problem hiding this comment.
Pull request overview
Enables Ruff’s flake8-pathlib (PTH) ruleset and updates a couple of places to use pathlib.Path instead of os.path, aligning the codebase with the new linting expectations.
Changes:
- Enable Ruff
PTHrules inpyproject.toml. - Migrate path handling to
pathlib.Pathintests/test_client.pyandutils/mask_fixtures.py. - Remove now-unneeded
os/globimports where applicable.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| utils/mask_fixtures.py | Replace glob/os.path.join + open() with Path.glob() + Path.open(). |
| tests/test_client.py | Replace os.path path construction with Path composition for fixture reads. |
| pyproject.toml | Turn on Ruff PTH lint ruleset. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # ruff: noqa: ASYNC230, S106 | ||
| # ruff: noqa: S106 | ||
| # S106: Test credentials use dummy values. | ||
| # ASYNC230: Blocking open() is acceptable for reading test fixtures |
There was a problem hiding this comment.
The file header comment mentions ASYNC230, but the file-level # ruff: noqa no longer ignores ASYNC230. Either remove/update the ASYNC230 comment or add ASYNC230 back to the noqa list so the header accurately reflects the lint configuration for this file.
| # ASYNC230: Blocking open() is acceptable for reading test fixtures |
| with (CURRENT_DIR / "fixtures/setup/setup_tahoma_1.json").open( | ||
| encoding="utf-8", |
There was a problem hiding this comment.
Like above, this builds the path using a string containing separators ("fixtures/setup/setup_tahoma_1.json"). Prefer composing the path with separate segments (e.g., "fixtures" / "setup" / "setup_tahoma_1.json") to keep pathlib usage consistent and platform-agnostic.
- Replace os.path with pathlib.Path in tests and utils - Use Path / operator with split segments for consistency - Remove stale ASYNC230 noqa comment
Summary
os.pathusage withpathlib.Pathintest_client.pyandmask_fixtures.pyosimport where no longer neededTest plan
ruff check .passespytest— 280 tests pass