Skip to content

[Bug]: test_memory_import_does_not_require_cv2 fails when run in full session #163

Description

@Deepthit-23

Affected Component

Other / Not sure

Bug Description

The test test_memory_import_does_not_require_cv2 verifies that importing the memory service does not eagerly import the OpenCV-dependent tracker. However, when run in a full test runner session, other test files execute first and import cv2, caching it in sys.modules. As a result, the subsequent assertion checking that cv2 is absent fails.

Steps to Reproduce

Run the tracker and memory tests in a single command:

python -m pytest tests/test_tracker.py tests/test_memory.py -k test_memory_import_does_not_require_cv2 -v


### Expected Behavior

`test_memory_import_does_not_require_cv2` should successfully assert that importing memory doesn't trigger an eager import of `cv2`, even if `cv2` was imported in a prior test runner context.


### Actual Behavior

When the full test suite runs, `cv2` is eagerly imported by earlier tests (e.g., in `test_tracker.py`), causing the subsequent import test in `test_memory.py` to fail with:
AssertionError: assert 'cv2' not in sys.modules




### Python Version

3.11

### Operating System

Windows 11

### Inference Device

None

### Error Log / Traceback

```shell

Screenshots or Recordings

No response

Additional Context

No response

Checklist

  • I have searched existing issues and this is not a duplicate.
  • I have tested with the latest version of the main branch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions