Skip to content

fix: test_slack_watchdog.py fails at collection due to relative path #341

Closed

Description

@vybe

Summary

tests/unit/test_slack_watchdog.py fails at pytest collection time with FileNotFoundError because it uses a relative path that only works when pytest is invoked from the project root.

Reproduction

cd tests && pytest unit/test_slack_watchdog.py
# FileNotFoundError: No such file or directory: '.../tests/src/backend/adapters/transports/slack_socket.py'

Error Details

FileNotFoundError: No such file or directory: '/Users/.../tests/src/backend/adapters/transports/slack_socket.py'

The file uses "src/backend/adapters/transports/slack_socket.py" in importlib.util.spec_from_file_location at line 64. This path resolves relative to the current working directory, not the file location.

Fix

Change line 64 to use __file__-relative path:

import os

_spec = importlib.util.spec_from_file_location(
    "adapters.transports.slack_socket",
    os.path.join(os.path.dirname(__file__), "..", "..", "src", "backend", "adapters", "transports", "slack_socket.py"),
)

Impact

29 watchdog tests are being skipped due to this collection error.

Activity

  1. vybe commented on Apr 16, 2026

    @vybe
    ContributorAuthor

    Fixed in commit 4445193 (PR #343) — replaced relative path with __file__-based path resolution for cross-directory test execution.

  2. added
    complexity-low
    on Jun 3, 2026
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

    complexity-lowpriority-p2type-bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions