feat: remove psutil#305
Conversation
woah 1 less dependency for 1 more dependency??
Reviewer's GuideThis PR removes the psutil dependency and reimplements mounted-drive discovery per-OS using standard libraries and system interfaces, adding unit tests around the new drive discovery logic. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📜 Recent review details⏰ Context from checks skipped due to timeout. (14)
📝 WalkthroughWalkthroughChangesDrive discovery
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tests/test_drive_workers.py" line_range="85-94" />
<code_context>
+ assert drives == ["A:/", "C:/"]
+
+
+def test_get_mounted_drives_applies_exclude_patterns(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ monkeypatch.setattr(drive_workers, "_get_posix_drives", lambda: ["/", "/mnt/usb"])
+ monkeypatch.setattr(drive_workers.path, "isdir", lambda p: True)
+
+ config = cast("RovrConfig", {"settings": {"drive_exclude": ["/mnt/*"]}})
+ drives = drive_workers.get_mounted_drives("Darwin", config)
+
+ assert drives == ["/"]
+
+
</code_context>
<issue_to_address>
**suggestion (testing):** Add coverage for path.isdir filtering in get_mounted_drives to ensure non-directory mountpoints are excluded.
The current tests patch `path.isdir` to always return `True`, so the directory filtering in `get_mounted_drives` is not actually validated. Please add a test where `_get_posix_drives`/`_get_linux_drives` returns both directory and non-directory mountpoints, and `path.isdir` is patched to return `False` for the invalid ones. This will verify that non-directory entries are excluded and protect against regressions in that logic.
Suggested implementation:
```python
from typing import cast
import pytest
from rovr.classes.config import RovrConfig
from rovr.functions import drive_workers
```
```python
@pytest.fixture
def config() -> RovrConfig:
return cast("RovrConfig", {"settings": {"drive_exclude": []}})
def test_get_mounted_drives_filters_non_directory_posix_mounts(
monkeypatch: pytest.MonkeyPatch,
config: RovrConfig,
) -> None:
"""
Ensure get_mounted_drives filters out mountpoints that are not directories
on POSIX-like systems.
"""
# Mix of directory and non-directory mountpoints
monkeypatch.setattr(
drive_workers,
"_get_posix_drives",
lambda: ["/", "/mnt/usb", "/not_a_directory"],
)
def fake_isdir(path: str) -> bool:
# Treat "/not_a_directory" as a non-directory mountpoint
return path != "/not_a_directory"
monkeypatch.setattr(drive_workers.path, "isdir", fake_isdir)
drives = drive_workers.get_mounted_drives("Darwin", config)
assert drives == ["/", "/mnt/usb"]
def test_get_mounted_drives_filters_non_directory_linux_mounts(
monkeypatch: pytest.MonkeyPatch,
config: RovrConfig,
) -> None:
"""
Ensure get_mounted_drives filters out mountpoints that are not directories
on Linux.
"""
monkeypatch.setattr(
drive_workers,
"_get_linux_drives",
lambda: ["/", "/media/usb", "/proc", "/not_a_directory"],
)
def fake_isdir(path: str) -> bool:
# Simulate "/not_a_directory" being invalid
return path != "/not_a_directory"
monkeypatch.setattr(drive_workers.path, "isdir", fake_isdir)
drives = drive_workers.get_mounted_drives("Linux", config)
assert drives == ["/", "/media/usb", "/proc"]
```
</issue_to_address>
### Comment 2
<location path="tests/test_drive_workers.py" line_range="110-119" />
<code_context>
+ assert drives == ["/"]
+
+
+def test_get_mounted_drives_linux_falls_back_to_posix_on_oserror(
+ monkeypatch: pytest.MonkeyPatch, config: RovrConfig
+) -> None:
+ monkeypatch.setattr(
+ drive_workers,
+ "_get_linux_drives",
+ lambda: (_ for _ in ()).throw(OSError("no procfs")),
+ )
+ monkeypatch.setattr(drive_workers, "_get_posix_drives", lambda: ["/data"])
+ monkeypatch.setattr(drive_workers.path, "isdir", lambda p: True)
+
+ drives = drive_workers.get_mounted_drives("Linux", config)
+
+ assert drives == ["/data"]
</code_context>
<issue_to_address>
**suggestion (testing):** There is no test for get_mounted_drives behavior on Windows, only for the Windows helper.
Please add a test that calls `get_mounted_drives("Windows", config)` directly, with `_get_windows_drives` patched to return a mix of drive letters. The test should assert that the function normalises drive paths correctly and respects `path.isdir` and any exclusion patterns, so the Windows integration path is covered end-to-end.
Suggested implementation:
```python
def test_get_mounted_drives_linux_falls_back_to_posix_on_oserror(
monkeypatch: pytest.MonkeyPatch, config: RovrConfig
) -> None:
monkeypatch.setattr(
drive_workers,
"_get_linux_drives",
lambda: (_ for _ in ()).throw(OSError("no procfs")),
)
monkeypatch.setattr(drive_workers, "_get_posix_drives", lambda: ["/data"])
monkeypatch.setattr(drive_workers.path, "isdir", lambda p: True)
drives = drive_workers.get_mounted_drives("Linux", config)
assert drives == ["/data"]
def test_get_mounted_drives_windows_normalises_and_applies_exclusions(
monkeypatch: pytest.MonkeyPatch,
config: RovrConfig,
) -> None:
# Return a mix of drive specifications, some missing trailing slashes
# and one that should be excluded via config.
monkeypatch.setattr(
drive_workers,
"_get_windows_drives",
lambda: ["C:", "D:\\", "E:\\Data", "F:", "G:\\"],
)
# Only some of the normalised drives should be considered "mounted".
def fake_isdir(path_str: str) -> bool:
# Expect get_mounted_drives to normalise to full root paths (with backslash)
# and preserve subdirectory paths where appropriate.
return path_str in {"C:\\", "D:\\", "E:\\Data"}
monkeypatch.setattr(drive_workers.path, "isdir", fake_isdir)
# Configure an exclusion pattern so that the E:\Data drive is filtered out,
# even though path.isdir returns True for it.
# Adjust this attribute name/pattern to match the real RovrConfig interface.
config.drive_exclusion_patterns = [r"^E:\\Data$"]
drives = drive_workers.get_mounted_drives("Windows", config)
# C and D are mounted and not excluded; E:\Data is mounted but excluded;
# F and G are not mounted (fake_isdir returns False after normalisation).
assert drives == ["C:\\", "D:\\"]
```
The new Windows integration test assumes:
1. `get_mounted_drives("Windows", config)` normalises drive roots to include a trailing backslash (e.g. `"C:"` → `"C:\\"`).
2. `RovrConfig` exposes a `drive_exclusion_patterns` attribute that is consulted by `get_mounted_drives` to filter out matches. If your config uses a different attribute name or semantics (e.g. `exclude_paths`, `windows_drive_exclusions`, etc.), update the test to set the correct field and pattern.
3. The exclusion logic operates on the already-normalised drive path strings; if it currently matches raw drive strings from `_get_windows_drives`, you may want to adjust either the implementation or the test so they align.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| def test_get_mounted_drives_applies_exclude_patterns( | ||
| monkeypatch: pytest.MonkeyPatch, | ||
| ) -> None: | ||
| monkeypatch.setattr(drive_workers, "_get_posix_drives", lambda: ["/", "/mnt/usb"]) | ||
| monkeypatch.setattr(drive_workers.path, "isdir", lambda p: True) | ||
|
|
||
| config = cast("RovrConfig", {"settings": {"drive_exclude": ["/mnt/*"]}}) | ||
| drives = drive_workers.get_mounted_drives("Darwin", config) | ||
|
|
||
| assert drives == ["/"] |
There was a problem hiding this comment.
suggestion (testing): Add coverage for path.isdir filtering in get_mounted_drives to ensure non-directory mountpoints are excluded.
The current tests patch path.isdir to always return True, so the directory filtering in get_mounted_drives is not actually validated. Please add a test where _get_posix_drives/_get_linux_drives returns both directory and non-directory mountpoints, and path.isdir is patched to return False for the invalid ones. This will verify that non-directory entries are excluded and protect against regressions in that logic.
Suggested implementation:
from typing import cast
import pytest
from rovr.classes.config import RovrConfig
from rovr.functions import drive_workers@pytest.fixture
def config() -> RovrConfig:
return cast("RovrConfig", {"settings": {"drive_exclude": []}})
def test_get_mounted_drives_filters_non_directory_posix_mounts(
monkeypatch: pytest.MonkeyPatch,
config: RovrConfig,
) -> None:
"""
Ensure get_mounted_drives filters out mountpoints that are not directories
on POSIX-like systems.
"""
# Mix of directory and non-directory mountpoints
monkeypatch.setattr(
drive_workers,
"_get_posix_drives",
lambda: ["/", "/mnt/usb", "/not_a_directory"],
)
def fake_isdir(path: str) -> bool:
# Treat "/not_a_directory" as a non-directory mountpoint
return path != "/not_a_directory"
monkeypatch.setattr(drive_workers.path, "isdir", fake_isdir)
drives = drive_workers.get_mounted_drives("Darwin", config)
assert drives == ["/", "/mnt/usb"]
def test_get_mounted_drives_filters_non_directory_linux_mounts(
monkeypatch: pytest.MonkeyPatch,
config: RovrConfig,
) -> None:
"""
Ensure get_mounted_drives filters out mountpoints that are not directories
on Linux.
"""
monkeypatch.setattr(
drive_workers,
"_get_linux_drives",
lambda: ["/", "/media/usb", "/proc", "/not_a_directory"],
)
def fake_isdir(path: str) -> bool:
# Simulate "/not_a_directory" being invalid
return path != "/not_a_directory"
monkeypatch.setattr(drive_workers.path, "isdir", fake_isdir)
drives = drive_workers.get_mounted_drives("Linux", config)
assert drives == ["/", "/media/usb", "/proc"]There was a problem hiding this comment.
Is it even possible for a mountpoint to be a file?
There was a problem hiding this comment.
Short answer: in normal, well-behaved systems, mountpoints are directories – that’s what mount(2) expects, and what /proc/mounts and df report. A regular file as a mountpoint is effectively “misconfigured” and outside typical POSIX semantics.
So you’re right to be skeptical: under ordinary circumstances, you shouldn’t see file paths in the mountpoint column.
Why the isdir check still exists:
- It’s defensive: we’re parsing text from
/proc/mountsordfoutput. If that parsing ever regressed (e.g. bad splitting, unescaped spaces, odd platform quirk), we could end up with a bogus path. - It also guards against things like:
- A mountpoint path that no longer exists (removed after mount, or stale record).
- Symlinks or strange FUSE setups that resolve to something unexpected.
In other words, the filtering is not really about “real” filesystems mounting on regular files, but about making sure we only return paths that are currently directories on the local filesystem.
Given that, the tests I suggested are less about modeling a realistic OS state, and more about verifying that this defensive guard does what we expect if it ever needs to kick in. If you feel that’s too hypothetical, an alternative is:
- Keep the
isdircheck in code (it’s cheap and safe), but - Add a single focused test that mocks
_get_posix_drives/_get_linux_drivesto return an obviously bogus path, and asserts that it’s filtered out.
I’m happy to propose a more minimal test variant if you’d prefer to avoid over-specifying unrealistic scenarios.
| def test_get_mounted_drives_linux_falls_back_to_posix_on_oserror( | ||
| monkeypatch: pytest.MonkeyPatch, config: RovrConfig | ||
| ) -> None: | ||
| monkeypatch.setattr( | ||
| drive_workers, | ||
| "_get_linux_drives", | ||
| lambda: (_ for _ in ()).throw(OSError("no procfs")), | ||
| ) | ||
| monkeypatch.setattr(drive_workers, "_get_posix_drives", lambda: ["/data"]) | ||
| monkeypatch.setattr(drive_workers.path, "isdir", lambda p: True) |
There was a problem hiding this comment.
suggestion (testing): There is no test for get_mounted_drives behavior on Windows, only for the Windows helper.
Please add a test that calls get_mounted_drives("Windows", config) directly, with _get_windows_drives patched to return a mix of drive letters. The test should assert that the function normalises drive paths correctly and respects path.isdir and any exclusion patterns, so the Windows integration path is covered end-to-end.
Suggested implementation:
def test_get_mounted_drives_linux_falls_back_to_posix_on_oserror(
monkeypatch: pytest.MonkeyPatch, config: RovrConfig
) -> None:
monkeypatch.setattr(
drive_workers,
"_get_linux_drives",
lambda: (_ for _ in ()).throw(OSError("no procfs")),
)
monkeypatch.setattr(drive_workers, "_get_posix_drives", lambda: ["/data"])
monkeypatch.setattr(drive_workers.path, "isdir", lambda p: True)
drives = drive_workers.get_mounted_drives("Linux", config)
assert drives == ["/data"]
def test_get_mounted_drives_windows_normalises_and_applies_exclusions(
monkeypatch: pytest.MonkeyPatch,
config: RovrConfig,
) -> None:
# Return a mix of drive specifications, some missing trailing slashes
# and one that should be excluded via config.
monkeypatch.setattr(
drive_workers,
"_get_windows_drives",
lambda: ["C:", "D:\\", "E:\\Data", "F:", "G:\\"],
)
# Only some of the normalised drives should be considered "mounted".
def fake_isdir(path_str: str) -> bool:
# Expect get_mounted_drives to normalise to full root paths (with backslash)
# and preserve subdirectory paths where appropriate.
return path_str in {"C:\\", "D:\\", "E:\\Data"}
monkeypatch.setattr(drive_workers.path, "isdir", fake_isdir)
# Configure an exclusion pattern so that the E:\Data drive is filtered out,
# even though path.isdir returns True for it.
# Adjust this attribute name/pattern to match the real RovrConfig interface.
config.drive_exclusion_patterns = [r"^E:\\Data$"]
drives = drive_workers.get_mounted_drives("Windows", config)
# C and D are mounted and not excluded; E:\Data is mounted but excluded;
# F and G are not mounted (fake_isdir returns False after normalisation).
assert drives == ["C:\\", "D:\\"]The new Windows integration test assumes:
get_mounted_drives("Windows", config)normalises drive roots to include a trailing backslash (e.g."C:"→"C:\\").RovrConfigexposes adrive_exclusion_patternsattribute that is consulted byget_mounted_drivesto filter out matches. If your config uses a different attribute name or semantics (e.g.exclude_paths,windows_drive_exclusions, etc.), update the test to set the correct field and pattern.- The exclusion logic operates on the already-normalised drive path strings; if it currently matches raw drive strings from
_get_windows_drives, you may want to adjust either the implementation or the test so they align.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/rovr/functions/drive_workers.py (1)
90-106: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocstring is stale relative to the new per-OS branching.
The
Argsdocs still describeos_typeas"Windows","Darwin", or other, but the changed logic now special-cases"Linux"with its own OSError→POSIX fallback (lines 100-104). Worth updating the docstring so the Linux-specific fallback contract is documented for future maintainers.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/rovr/functions/drive_workers.py` around lines 90 - 106, Update the docstring for the function containing the raw drive selection logic to document that os_type explicitly supports Windows, Linux, and other values, and that Linux falls back to POSIX drive detection when _get_linux_drives raises OSError. Keep the existing behavior unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/rovr/functions/drive_workers.py`:
- Around line 69-83: The direct df invocation in _get_posix_drives must not
block indefinitely. Add a finite timeout to the subprocess.run call used by
_get_posix_drives, preserving its existing output capture, text mode, and check
behavior.
---
Nitpick comments:
In `@src/rovr/functions/drive_workers.py`:
- Around line 90-106: Update the docstring for the function containing the raw
drive selection logic to document that os_type explicitly supports Windows,
Linux, and other values, and that Linux falls back to POSIX drive detection when
_get_linux_drives raises OSError. Keep the existing behavior unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 0d55c523-9bfe-4a10-a789-480cf0644100
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (3)
pyproject.tomlsrc/rovr/functions/drive_workers.pytests/test_drive_workers.py
💤 Files with no reviewable changes (1)
- pyproject.toml
📜 Review details
⏰ Context from checks skipped due to timeout. (7)
- GitHub Check: Sourcery review
- GitHub Check: Test on (windows-arm, Python 3.14)
- GitHub Check: Test on (macos-x64, Python 3.14)
- GitHub Check: Test on (windows-arm, Python 3.13)
- GitHub Check: Test on (windows-x64, Python 3.14)
- GitHub Check: Test on (macos-x64, Python 3.13)
- GitHub Check: Test on (windows-x64, Python 3.13)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
**/*.py: Use Python 3.12+ for all Python source files in this project.
Use double quotes (") in Python source files.
Use 4-space indentation in Python source files.
Useruffas the formatter for Python code; do not use Black.
Use absolute imports only in Python files; do not use relative imports.
All Python functions must have type annotations; usetyfor type checking.
Do not useif TYPE_CHECKINGblocks for imports.
Use the project naming conventions in Python code:CamelCasefor classes,snake_casefor functions and variables,UPPER_CASEfor constants, and_prefixes for private names.
Use specific exceptions in Python code; do not use bareexcept:blocks.
Usecontextlib.suppressfor expected errors in Python code.
Files:
src/rovr/functions/drive_workers.pytests/test_drive_workers.py
src/rovr/**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
In Textual-related Python code, inherit from Textual widgets with
inherit_bindings=Falsefor custom keybindings; use@on(EventType)oron_eventfor event handling; use@workfor async background work (withthread=Truefor blocking tasks); usecompose()for widget composition; and usecall_from_thread/call_next/call_later/call_after_refreshfor thread-driven widget updates.
Files:
src/rovr/functions/drive_workers.py
🧠 Learnings (8)
📚 Learning: 2025-12-11T03:10:54.344Z
Learnt from: NSPC911
Repo: NSPC911/rovr PR: 167
File: src/rovr/footer/process_container.py:346-346
Timestamp: 2025-12-11T03:10:54.344Z
Learning: In Python/Textual code, when calling checker_wrapper() or any other method that starts workers from within a work(thread=True) decorated method, do not wrap the call in call_from_thread. Starting workers is thread-safe in Textual and the work decorator handles threading. Only UI updates (e.g., DOM modifications) from worker threads require call_from_thread. Apply this guideline to Python files across the codebase where worker-start calls occur; do not wrap such calls with call_from_thread.
Applied to files:
src/rovr/functions/drive_workers.pytests/test_drive_workers.py
📚 Learning: 2026-01-24T02:10:57.940Z
Learnt from: NSPC911
Repo: NSPC911/rovr PR: 203
File: src/rovr/first_launch.py:273-295
Timestamp: 2026-01-24T02:10:57.940Z
Learning: In the rovr codebase (Python/Textual), App.notify() is thread-safe and may be called directly from worker threads decorated with work(thread=True) without wrapping in call_from_thread(). Only DOM modifications require call_from_thread from worker threads. Apply this guideline to Python files across the codebase (not just a single file) and avoid unnecessary call_from_thread() wrappers when invoking App.notify() from worker threads.
Applied to files:
src/rovr/functions/drive_workers.pytests/test_drive_workers.py
📚 Learning: 2026-01-30T13:54:15.110Z
Learnt from: NSPC911
Repo: NSPC911/rovr PR: 207
File: src/rovr/first_launch.py:96-107
Timestamp: 2026-01-30T13:54:15.110Z
Learning: In Python projects using the Textual framework, async workers decorated with work are automatically cancelled when the parent screen/widget is dismissed or unmounted. Do not add manual cancellation in cleanup/dismiss handlers for these workers; rely on Textual to cancel them. Verify this behavior against the project’s Textual version before relying on it.
Applied to files:
src/rovr/functions/drive_workers.pytests/test_drive_workers.py
📚 Learning: 2026-02-27T09:15:49.243Z
Learnt from: NSPC911
Repo: NSPC911/rovr PR: 229
File: src/rovr/functions/system_clipboard.py:143-143
Timestamp: 2026-02-27T09:15:49.243Z
Learning: In Python files that display error messages in toast/notification UI (e.g., ClipboardError and similar exceptions), escape unescaped square brackets in the message so the toast system does not interpret them as markup. Specifically render the content with double backslashes before brackets, e.g. "\\[{type(exc).__name__}]" in the toast description. This guideline applies to all Python files that format and show exception details in toasts across the codebase.
Applied to files:
src/rovr/functions/drive_workers.pytests/test_drive_workers.py
📚 Learning: 2025-12-11T03:11:24.387Z
Learnt from: NSPC911
Repo: NSPC911/rovr PR: 167
File: src/rovr/screens/fd_search.py:205-209
Timestamp: 2025-12-11T03:11:24.387Z
Learning: In src/rovr/screens/fd_search.py, FileSearch.FILTER_TYPES should be implemented as a class attribute (not an instance attribute) to persist filter state across all modal instances within the same session. This enables remember/restore of filter settings when the modal is dismissed and reopened. Ensure this behavior is intentional, document the session lifecycle implications, and include tests verifying persistence across modal reopenings, as well as proper reset or isolation when a new session starts. If applicable, consider thread-safety and potential memory growth due to long-lived state.
Applied to files:
src/rovr/functions/drive_workers.py
📚 Learning: 2025-12-11T03:11:27.833Z
Learnt from: NSPC911
Repo: NSPC911/rovr PR: 167
File: src/rovr/screens/fd_search.py:205-209
Timestamp: 2025-12-11T03:11:27.833Z
Learning: In src/rovr/screens/fd_search.py, document that the FileSearch class uses a class-level FILTER_TYPES dict to persist filter settings across multiple modal invocations within a single application session. Ensure this pattern is intentional by clarifying the lifecycle of the shared state (lifetime of the process/session) and the implications of mutable shared state (thread-safety, potential memory retention). Consider alternatives (per-instance state, dedicated session storage, explicit reset method) and add tests to verify persistence, correctness after modal reopenings, and safe reset behavior. Also mention any framework or runtime constraints that affect shared-class state.
Applied to files:
src/rovr/functions/drive_workers.py
📚 Learning: 2026-01-03T14:17:18.132Z
Learnt from: lazysegtree
Repo: NSPC911/rovr PR: 184
File: src/rovr/core/preview_container.py:280-283
Timestamp: 2026-01-03T14:17:18.132Z
Learning: In src/rovr/core/preview_container.py, mypy may not recognize that pdfinfo_from_path's poppler_path parameter accepts None even though the library signature is Optional[Union[str, pathlib.PurePath]]. If you encounter a type error, explicitly cast the argument to Optional[Union[str, pathlib.PurePath]] before passing it (e.g., from typing import cast; pdfinfo_from_path(path, poppler_path=cast(Optional[Union[str, pathlib.PurePath]], None)) or cast the argument to the expected type). This documents the typing limitation and provides a repeatable workaround for similar cases.
Applied to files:
src/rovr/functions/drive_workers.py
📚 Learning: 2026-03-01T10:35:17.682Z
Learnt from: NSPC911
Repo: NSPC911/rovr PR: 233
File: tests/test_functions_path.py:21-21
Timestamp: 2026-03-01T10:35:17.682Z
Learning: In Python test files (using the Textual framework), use an assertion like Static(id=val, classes=val) to verify that the value contains only characters valid for Textual IDs and classes. The test should confirm initialization succeeds without raising BadIdentifier (do not test attribute storage). This pattern is applicable to tests that validate Textual-compatible identifier strings returned by utilities (e.g., compress/decompress). Apply this guideline to test files under the tests/ directory (e.g., tests/**/*.py) where relevant.
Applied to files:
tests/test_drive_workers.py
🪛 ast-grep (0.44.1)
src/rovr/functions/drive_workers.py
[error] 71-71: Command coming from incoming request
Context: subprocess.run(["df", "-P"], capture_output=True, text=True, check=True)
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
(subprocess-from-request)
🔇 Additional comments (4)
src/rovr/functions/drive_workers.py (3)
4-12: LGTM!
35-66: LGTM!Verified
_get_windows_drivesand_get_linux_drivesagainst the corresponding tests (bitmask decoding,/proc/filesystems"nodev" filtering with the zfs/btrfs special-case, and octal-escape unmangling) — behaviour matches exactly.
107-107: LGTM!Confirmed the dispatch/fallback chain (
Windows→_get_windows_drives,Linux→_get_linux_driveswithOSErrorfallback to_get_posix_drives, else →_get_posix_drives, thennormalise+isdirfiltering) matches all fiveget_mounted_drivestests exactly.tests/test_drive_workers.py (1)
1-124: LGTM!Solid coverage of the new platform-specific helpers and the aggregation/fallback logic in
get_mounted_drives, including the LinuxOSError→POSIX fallback path.
woah 1 less dependency for 1 more dependency??
by submitting this pull request, i agree that
poe checkto check for any style issues and fixed thempoe testif applicable) to make sure my changes do not break anythingpoe gen-schemaandpoe gen-keysif applicable)Summary by Sourcery
Replace psutil-based drive detection with platform-specific implementations and update dependencies and tests accordingly.
New Features:
Bug Fixes:
Enhancements:
Build:
Tests:
Summary by CodeRabbit