Skip to content

nightshift: test-gap — zero test coverage in Python module (39 tests recommended) #5

Description

@nightshift-micr

nightshift: test-gap — zero test coverage in veyoff Python module

Repo: Microck/veyoff
Task: test-gap
Category: analysis
Generated: 2026-04-21


Summary

The Python module (src/veyoff/, ~527 LOC across 6 files) has zero test files. No tests/ directory exists, no test_*.py or *_test.py files anywhere in the repo. The CI workflow (build.yml) only runs ruff check and Python build — no test step.

The C++ component (src/windows/veyoff-windows.cpp, 2301 lines) is also untested but requires Windows build tooling, so this analysis focuses on the Python module.


Test Gap Analysis by Module

🔴 Critical — Pure logic, no OS/display dependencies

Module File LOC Untested Functions Priority
filter src/veyoff/filter.py 118 load_blacklist, title_matches_blacklist, blackout_windows, WindowFilter.apply High
overlay src/veyoff/overlay.py 149 _parse_ss_output, detect_master_connection, PresenceOverlay.update/show/hide High
hotkey src/veyoff/hotkey.py 71 FreezeController.toggle/freeze/unfreeze High
main src/veyoff/main.py 103 _status_from_state High

🟡 Medium — Requires mocking display/capture

Module File LOC Untested Functions Priority
capture src/veyoff/capture.py 72 ScreenCapture.get_output_frame (freeze logic), save_frame_to_buffer Medium
filter src/veyoff/filter.py — enumerate_windows, _walk_windows (X11 dependency) Medium
overlay src/veyoff/overlay.py — PresenceOverlay._run_tk_loop (tkinter dependency) Medium

Recommended Tests (Priority Order)

1. tests/test_filter.py — Pure logic tests (no mocks needed)

# Test load_blacklist
- Loads entries from a temp file
- Skips comments (#) and blank lines
- Returns empty list for missing file

# Test title_matches_blacklist
- Case-insensitive matching ("Discord" matches "discord")
- Partial match ("Discord - General" matches "discord")
- No match returns False

# Test blackout_windows
- Blackout rectangles applied correctly to image
- Empty window list returns original image (same pixels)
- Negative coordinates clamped to 0

# Test WindowFilter.apply
- Returns original image when blacklist is empty
- Calls find_blacklisted_windows with loaded blacklist

2. tests/test_overlay.py — ss output parsing + connection detection

# Test _parse_ss_output
- Parses valid ss -tn output correctly
- Handles empty output
- Skips header lines and malformed lines
- Extracts local and remote ports from IPv4 and IPv6 addresses

# Test detect_master_connection
- Returns True when ESTAB connection on watched port
- Returns False when no connections on watched ports
- Ignores non-ESTAB states (TIME-WAIT, CLOSE-WAIT)
- Custom port list works
- Empty connections list returns False

# Test PresenceOverlay.update
- headless mode: show() and hide() update state without tkinter

3. tests/test_hotkey.py — FreezeController state machine

# Test FreezeController
- Starts unfrozen
- freeze() sets frozen=True
- unfreeze() sets frozen=False
- toggle() flips state and returns new state
- Thread safety: concurrent toggle calls don't corrupt state

# Test HotkeyManager.trigger_toggle
- Calls on_toggle callback with new state
- Works when on_toggle is None

4. tests/test_main.py — Status string logic

# Test _status_from_state
- All 4 state combinations return correct strings:
  - (frozen=False, master=False) -> "LIVE"
  - (frozen=True, master=False) -> "FROZEN"
  - (frozen=False, master=True) -> "LIVE | MASTER VIEWING"
  - (frozen=True, master=True) -> "FROZEN | MASTER VIEWING"

5. tests/test_capture.py — Freeze/caching behavior (with mss mock)

# Test ScreenCapture.get_output_frame
- When frozen=True and cache exists: returns cached frame (not fresh capture)
- When frozen=True and no cache: captures fresh frame
- When frozen=False: always captures fresh frame

# Test save_frame_to_buffer
- Stores frame and timestamp
- get_cached_frame returns copy (not reference)

CI Integration

Add a test step to .github/workflows/build.yml:

- name: Test Python module
  run: |
    pip install -e ".[dev]"
    python -m pytest tests/ -v

Add a [dev] extra to pyproject.toml or setup.py:

[project.optional-dependencies]
dev = ["pytest", "pytest-cov"]

Estimated Test LOC

Module Test File Estimated Tests Estimated LOC
filter test_filter.py 12 120
overlay test_overlay.py 10 100
hotkey test_hotkey.py 8 80
main test_main.py 4 40
capture test_capture.py 5 60
Total 39 ~400

Generated by nightshift — autonomous code quality bot.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    dayshift/failedManaged by hermes-dayshift-glm

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions