docs: testing patterns + Python 3.13 deprecation notes (v1.9.1)#38
Conversation
…13 deprecation notes Fills two gaps in the skill after the 1.9.0 docs pass: - New patterns/testing.md covers Pattern A (unit tests with mocked indigo via unittest.mock) and Pattern B (live integration with TestingBase submodule + APIBase + ValidateXmlFile). Documents both as complementary, with a side-by-side comparison and setup instructions. - Python3-Migration-Guide.md gains an "Indigo 2025.2 / Python 3.11 → 3.13" section covering generic 3.13 deprecations not specific to a particular library: datetime.utcnow, asyncio.get_event_loop, pkg_resources, the PEP 594 stdlib removals (cgi/telnetlib/etc.), and the imp/distutils removals from 3.12. Cross-links to the existing troubleshooting section for library-specific breakages. - /indigo:dev routing (commands/dev.md + skills/dev/SKILL.md) now surfaces the testing doc on prompts mentioning "test", "pytest", "mocking", or "TestingBase". - Bump plugin.json + marketplace.json to 1.10.0 (minor — new docs surface). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughPlugin version incremented from 1.9.0 to 1.10.0 across manifest files. Two new documentation files added: testing patterns guide covering unit tests and integration testing with TestingBase, and Python 3.11→3.13 migration guide for Indigo 2025.2. Documentation routing tables updated to reference new content. ChangesVersion 1.10.0 Release with Documentation Additions
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
docs/plugin-dev/patterns/testing.md (1)
12-45: ⚡ Quick winMake Pattern A’s
indigomocking concrete (add asys.modulespatch example).Pattern A says to mock
indigoand then import the plugin module directly, but the “reference shape” snippet only providesmock_logger()and doesn’t demonstrate the critical step: patchingsys.modules["indigo"](or otherwise ensuring imports succeed without Indigo).Add a minimal example showing how to wrap the plugin import with
patch.dict(sys.modules, {"indigo": ...})(module path can be a placeholder).✅ Proposed fix (doc snippet)
import sys from pathlib import Path -from unittest.mock import Mock +from unittest.mock import Mock, patch import pytest ... `@pytest.fixture` def mock_logger(): logger = Mock() for level in ("debug", "info", "warning", "error", "exception"): setattr(logger, level, Mock()) return logger +@pytest.fixture +def mock_indigo(): + # Provide only the attributes your plugin touches at import/runtime. + return Mock()And update the narrative around Line 44 to explicitly say something like:
“Wrap your import with
patch.dict(sys.modules, {"indigo": mock_indigo})so the plugin can be imported without an Indigo install.”🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/plugin-dev/patterns/testing.md` around lines 12 - 45, Add a concrete example showing how to patch sys.modules before importing the plugin so imports of the indigo package succeed: update tests/conftest.py (alongside existing SERVER_PLUGIN_DIR and mock_logger fixture) to create a mock_indigo module and use patch.dict(sys.modules, {"indigo": mock_indigo}) around the import of your plugin, and update the narrative near the existing reference to say “Wrap your import with patch.dict(sys.modules, {'indigo': mock_indigo}) so the plugin can be imported without an Indigo install.” Ensure you reference the mock_indigo object when describing the patch and keep the change adjacent to the mock_logger fixture/example.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/plugin-dev/patterns/testing.md`:
- Around line 62-80: Two fenced code blocks in the docs (the directory tree
block starting with "my-plugin/" and the requirements snippet starting with "-r
shared/module-requirements.txt") lack language identifiers causing MD040; add a
language tag (e.g., ```text) to both fenced code blocks so they become ```text
... ``` to satisfy markdownlint and improve readability.
---
Nitpick comments:
In `@docs/plugin-dev/patterns/testing.md`:
- Around line 12-45: Add a concrete example showing how to patch sys.modules
before importing the plugin so imports of the indigo package succeed: update
tests/conftest.py (alongside existing SERVER_PLUGIN_DIR and mock_logger fixture)
to create a mock_indigo module and use patch.dict(sys.modules, {"indigo":
mock_indigo}) around the import of your plugin, and update the narrative near
the existing reference to say “Wrap your import with patch.dict(sys.modules,
{'indigo': mock_indigo}) so the plugin can be imported without an Indigo
install.” Ensure you reference the mock_indigo object when describing the patch
and keep the change adjacent to the mock_logger fixture/example.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 32b2a6d9-71f3-4853-ac3e-3983dee01b86
📒 Files selected for processing (6)
.claude-plugin/marketplace.json.claude-plugin/plugin.jsoncommands/dev.mddocs/plugin-dev/patterns/testing.mdreference/Python3-Migration-Guide.mdskills/dev/SKILL.md
| **Layout** (the convention TestingBase expects): | ||
|
|
||
| ``` | ||
| my-plugin/ | ||
| ├── tests/ | ||
| │ ├── shared/ # submodule — do NOT edit | ||
| │ ├── .env # gitignored — Indigo API credentials | ||
| │ ├── testing-requirements.txt # references shared/module-requirements.txt | ||
| │ ├── venv/ # gitignored — your test venv | ||
| │ └── test_my_plugin.py | ||
| ``` | ||
|
|
||
| `tests/.env` carries credentials — see `tests/shared/ENV_TEMPLATE` for the exact keys. `tests/testing-requirements.txt` should chain to the shared list: | ||
|
|
||
| ``` | ||
| -r shared/module-requirements.txt | ||
| # anything else your tests need | ||
| ``` | ||
|
|
There was a problem hiding this comment.
Add language identifiers to unlabeled fenced code blocks (MD040).
markdownlint-cli2 is flagging fenced blocks without a language at Line 64 and Line 76. Add a language tag (e.g., text) to avoid lint failures and improve readability.
✅ Proposed fix
-```
+```text
my-plugin/
├── tests/
│ ├── shared/ # submodule — do NOT edit
│ ├── .env # gitignored — Indigo API credentials
│ ├── testing-requirements.txt # references shared/module-requirements.txt
│ ├── venv/ # gitignored — your test venv
│ └── test_my_plugin.py...
- +text
-r shared/module-requirements.txt
anything else your tests need
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)
[warning] 64-64: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
[warning] 76-76: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/plugin-dev/patterns/testing.md` around lines 62 - 80, Two fenced code
blocks in the docs (the directory tree block starting with "my-plugin/" and the
requirements snippet starting with "-r shared/module-requirements.txt") lack
language identifiers causing MD040; add a language tag (e.g., ```text) to both
fenced code blocks so they become ```text ... ``` to satisfy markdownlint and
improve readability.
… idiom, downgrade to 1.9.1 Review findings on PR #38: - reference/Python3-Migration-Guide.md: asyncio.get_event_loop() DeprecationWarning was added in 3.12 (cpython gh-100160), not 3.10. Fixed. - reference/Python3-Migration-Guide.md: PEP 594 list was missing cgitb and msilib (verified against the 3.13 What's New). Added. - reference/Python3-Migration-Guide.md: dropped unverified specific patch claim "3.13.9" to plain "3.13". - docs/plugin-dev/patterns/testing.md: ValidateXmlFile example used a hardcoded absolute path which fails across machines. Switched to upstream's os.path-relative idiom. - docs/plugin-dev/patterns/testing.md: clarified APIBase is abstract (not just any TestCase) so readers don't try to instantiate it. - docs/plugin-dev/patterns/testing.md: refined "Slow (spawns processes per call)" — only run_host_script-based helpers spawn IPH3, not every assertion. Plain HTTP calls are just round-trips. - docs/plugin-dev/patterns/testing.md: added one-line clarifying comment to the mock_logger fixture explaining the explicit assigns are for readability (Mock auto-creates attrs on access). - docs/plugin-dev/patterns/README.md: added Testing entry to the index — was the only discoverability surface missed in the initial PR. - .claude-plugin/{plugin,marketplace}.json: scope-correct version bump 1.10.0 → 1.9.1. Pure docs additions are patch territory per the workspace memory rule (minor for user-visible features, patch for internal/reliability work). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Picks up where #(the v1.9.0 docs PR) left off. Adds two pieces of guidance the skill was missing for Indigo 2025.2 / Python 3.13:
New
docs/plugin-dev/patterns/testing.md— documents the two complementary testing patterns:unittest.mock(fast, no Indigo install, runs in CI)TestingBasesubmodule (`APIBase` + `ValidateXmlFile` against a running Indigo server)reference/Python3-Migration-Guide.md— appends an Indigo 2025.2 / Python 3.11 → 3.13 section. Complements the library-specific 2025.2 entries already in `troubleshooting/common-issues.md` (telnetlib, websockets, matplotlib) with the generic 3.13 deprecations: `datetime.utcnow`, `asyncio.get_event_loop`, `pkg_resources`, the PEP 594 stdlib removals, and the `imp`/`distutils` removals from 3.12.Routing — `/indigo:dev` (`commands/dev.md` + `skills/dev/SKILL.md`) now surfaces the testing doc on prompts mentioning test, pytest, mocking, or TestingBase.
Version bump: `1.9.0 → 1.10.0` in both `plugin.json` and `marketplace.json` (minor — new docs surface).
Test plan
Summary by CodeRabbit
Documentation
Chores