com um clique
rachis-unit-test-writer
Write or update unit tests for QIIME 2 plugin code
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Menu
Write or update unit tests for QIIME 2 plugin code
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Baseado na classificação ocupacional SOC
| name | rachis-unit-test-writer |
| description | Write or update unit tests for QIIME 2 plugin code |
Add or update unit tests for QIIME 2 plugin code by mirroring the local repo's test style instead of writing generic pytest tests. Inspect the nearest existing tests first, then use references/qiime2-test-patterns.md to match the conventions captured from q2-annotate (https://github.com/bokulich-lab/q2-annotate). Use when Codex needs to add tests for a module, method, function, pipeline, helper, or regression in a QIIME 2 plugin repo, especially when the repo expects TestPluginBase, reusable fixtures under tests/data, patched external APIs or command-line tools, and targeted pytest runs in a dedicated conda environment.
test_*.py files, the package's tests/data/ directory, and the repo's environment-files/ directory before editing.environment-files/. Prefer the most recent development environment file (e.g. environment-files/<package>-qiime2-<epoch>-py<ver>-<platform>-conda.yml). Extract the environment name from the name: field at the top of that file.test_*.py only when there is no natural home for the new coverage.qiime2.plugin.testing.TestPluginBase. Set package = "<package_path>.tests" so self.get_data_path(...) resolves fixtures.setUp when each test needs its own isolated copy of a fixture or mock — setUp runs before every test method.setUpClass only for expensive, read-only shared state (e.g., loading a large artifact once) that is safe to share across all tests in the class.tests/data/ directory. Treat reusable files as the default for inputs and expected outputs.subprocess.run or the repo's command wrapper unless the user explicitly asks to test the command execution.requests.get.assert_has_calls, output type checks, dataframe equality checks, existence checks for materialized files, and assertRaisesRegex for failure paths.TestPluginBase for unit tests in this style, even for helper-focused tests, unless the user explicitly asks to follow a different house style.self.get_data_path(...) instead of hard-coding fixture paths.setUp for per-test isolation; use setUpClass only for read-only shared state that is safe to reuse across all tests.self.plugin.methods[...] or self.plugin.pipelines[...] when testing registered plugin actions instead of reimplementing plugin wiring.tests/data/ can represent it.Discover the environment name from environment-files/ as described in step 2, then:
conda env create -f environment-files/<env-file>.yml
conda run -n <env-name> pip install -e . --no-deps --no-build-isolation
Only run the pip install step again if pyproject.toml dependencies change after the environment was created.
Always start with the narrowest possible selection and widen only after the target tests pass:
# Single test
conda run -n <env-name> python -m pytest path/to/test_file.py::TestClass::test_name -x --tb=short -v
# Full test class
conda run -n <env-name> python -m pytest path/to/test_file.py::TestClass -x --tb=short -v
# Full test file
conda run -n <env-name> python -m pytest path/to/test_file.py -x --tb=short -v
# Full package test suite (only after the above pass)
conda run -n <env-name> python -m pytest path/to/tests/ --tb=short
Use -x (fail fast) and --tb=short while iterating. Switch to --tb=long only when a traceback is too truncated to diagnose.
q2-annotate examples and highlights patterns to copy versus legacy patterns to avoid.