[#103] Fix test collection errors (nostr, telegram optional imports) #110

Merged
k9ert merged 1 commit from story-103 into main 2026-02-26 15:45:38 +00:00
Collaborator

Closes #103

Changes

Use pytest.importorskip() to gracefully skip tests when optional dependencies (pynostr, python-telegram-bot) are not installed, instead of crashing during test collection.

Also cleaned up unused imports (AsyncMock, CommunicationError) in telegram tests.

Acceptance Criteria

  • pytest --collect-only succeeds with no errors
  • Tests skipped gracefully when deps missing
  • Tests still run when deps ARE installed (nostr: 13 collected)
  • ruff check cobot/ passes

Results

  • 312 passed, 2 skipped, 0 errors
Closes #103 ## Changes Use `pytest.importorskip()` to gracefully skip tests when optional dependencies (`pynostr`, `python-telegram-bot`) are not installed, instead of crashing during test collection. Also cleaned up unused imports (`AsyncMock`, `CommunicationError`) in telegram tests. ## Acceptance Criteria - [x] `pytest --collect-only` succeeds with no errors - [x] Tests skipped gracefully when deps missing - [x] Tests still run when deps ARE installed (nostr: 13 collected) - [x] `ruff check cobot/` passes ## Results - 312 passed, 2 skipped, 0 errors
[#103] fix: guard optional imports in nostr and telegram tests
All checks were successful
CI / lint (pull_request) Successful in 9s
CI / test (3.11) (pull_request) Successful in 22s
CI / test (3.12) (pull_request) Successful in 24s
CI / test (3.13) (pull_request) Successful in 25s
E2E Tests / e2e (pull_request) Successful in 14s
CI / build (pull_request) Successful in 7s
fa5e5327d6
Use pytest.importorskip() to gracefully skip tests when optional
dependencies (pynostr, python-telegram-bot) are not installed,
instead of crashing during test collection.

Also fix unused imports (AsyncMock, CommunicationError) in telegram tests.
k9ert approved these changes 2026-02-26 15:45:27 +00:00
k9ert merged commit 1596afb743 into main 2026-02-26 15:45:38 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ultanio/cobot!110
No description provided.