Skip to content

[codex] Isolate daily summary Redis import#7947

Open
tianmind-studio wants to merge 1 commit into
BasedHardware:mainfrom
tianmind-studio:codex/windows-daily-summary-redis-stub
Open

[codex] Isolate daily summary Redis import#7947
tianmind-studio wants to merge 1 commit into
BasedHardware:mainfrom
tianmind-studio:codex/windows-daily-summary-redis-stub

Conversation

@tianmind-studio

Copy link
Copy Markdown
Contributor

Summary

  • Stub redis.Redis inside test_daily_summary_regenerate.py so the daily summary regenerate tests collect in lightweight Windows backend environments without the Redis SDK installed.
  • Restore the real backend/database package path if another stub-heavy test has already left a lightweight database package in sys.modules.
  • Populate database._client.db only when a previous test already installed a _client stub, keeping normal imports on the real module path.

Why

test_daily_summary_regenerate.py verifies that update_daily_summary preserves the existing document ID during regeneration. It does not exercise Redis, but importing database.daily_summaries also imports database.redis_db, which imports the optional Redis SDK at module import time. On this Windows lightweight backend venv, collection failed before the regression assertions could run:

ModuleNotFoundError: No module named 'redis'

Running after another lightweight test can also leave a stubbed database package and _client module in sys.modules; the test now restores the package path and fills the existing client stub with the minimal db attribute needed by database.daily_summaries.

Validation

  • python -m pytest backend\tests\unit\test_daily_summary_regenerate.py --collect-only -q --tb=short
  • python -m pytest backend\tests\unit\test_daily_summary_regenerate.py -q --tb=short
  • python -m pytest backend\tests\unit\test_action_item_date_validation.py backend\tests\unit\test_daily_summary_regenerate.py -q --tb=short
  • python -m pytest backend\tests\unit\test_daily_summary_regenerate.py backend\tests\unit\test_action_item_date_validation.py -q --tb=short
  • python -m black --line-length 120 --skip-string-normalization backend\tests\unit\test_daily_summary_regenerate.py
  • python -m py_compile backend\tests\unit\test_daily_summary_regenerate.py
  • git diff --check
  • scripts\pre-commit

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant