بنقرة واحدة
writing-tests
Use when writing new pytest tests, fixtures, or regression tests for aiida-core.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Use when writing new pytest tests, fixtures, or regression tests for aiida-core.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Use when adding a new `verdi` subcommand in `src/aiida/cmdline/`.
Use when adding a new third-party dependency to aiida-core's `pyproject.toml`.
Use when exploring the aiida-core codebase structure, looking for key files, or understanding how packages relate to each other.
Use when making commits, creating branches, or preparing pull requests for aiida-core.
Use when diagnosing failed, stuck, or misbehaving AiiDA processes or the daemon.
Use when deprecating a public Python API or `verdi` CLI command in aiida-core.
| name | writing-tests |
| description | Use when writing new pytest tests, fixtures, or regression tests for aiida-core. |
Tests live under tests/ and mirror the source layout in src/aiida/.
Reusable fixtures live in tests/conftest.py and per-subtree conftest.py files.
assert result == expected_value, not assert result is not None.
Check exact values, types, and lengths.@pytest.mark.presto: runs against SqliteTempBackend (in-memory, no PostgreSQL / RabbitMQ).
Prefer presto-compatible tests where possible: they are much faster and runnable in any environment.@pytest.mark.requires_rmq: requires a running RabbitMQ instance.@pytest.mark.requires_psql: requires a running PostgreSQL instance.@pytest.mark.nightly: long-running tests, only executed in nightly CI.Use pytest.mark.parametrize instead of duplicating test bodies:
import pytest
@pytest.mark.parametrize('value,expected', [
(1, 2),
(2, 4),
(3, 6),
])
def test_double(value, expected):
assert double(value) == expected
Check tests/conftest.py before writing ad-hoc setup.
If you find yourself reinventing a fixture, it probably already exists.
See the running-tests skill for the full uv run pytest cheatsheet.