Agent skill

Pytest Testing

by ArduPilot in ArduPilot/MethodicConfigurator

Write high-quality BDD pytest tests for the ArduPilot Methodic Configurator.

GPL-3.0Auto-check passedTesting & QA

Install Pytest Testing

skills CLI
$ npx skills add ArduPilot/MethodicConfigurator --skill pytest-testing -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ArduPilot/MethodicConfigurator pytest-testing --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ArduPilot/MethodicConfigurator.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.github/skills/pytest-testing .claude/skills/pytest-testing && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
pytest-testing
GitHub stars
163
Token cost
~3.5k tokens
SKILL.md length
688 words
Files
1
Skills in repo
11
Repo updated
First seen
Licence
GPL-3.0

At a glance

Write high-quality BDD pytest tests for the ArduPilot Methodic Configurator.

  • Works in 3 steps: Senior Developer Mindset → Behavior-Driven Development (BDD) → Test Isolation and Independence
  • Writing new unit tests
  • SKILL.md covers For AI Agents and Senior…, Core Testing Philosophy, 🔧 Fixture Guidelines and 📝 Test Structure Standards, plus 6 more sections
  • Calls pytest, ruff and git

What it does

Pytest Testing is an agent skill from ArduPilot/MethodicConfigurator. Write high-quality BDD pytest tests for the ArduPilot Methodic Configurator. Use when writing new unit tests, creating test fixtures, applying Given-When-Then pattern, testing tkinter frontends, or following the minimal-mocking strategy for backend and business logic.

Its SKILL.md is about 3.5k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Testing & QA, covering Unit testing. It works with pytest. The repository describes itself as: A clear ArduPilot configuration sequence. The licence is GPL-3.0.

When your agent uses it

  • Writing new unit tests
  • Creating test fixtures
  • Applying Given-When-Then pattern
  • Testing tkinter frontends

Example prompts

  • “/pytest-testing”

Requirements

  • Python 3

Workflow steps

3 steps, taken from the step headings in SKILL.md.

  1. Senior Developer Mindset
  2. Behavior-Driven Development (BDD)
  3. Test Isolation and Independence

What it can do on your machine

Read from SKILL.md and the folder at commit 1a6392c. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • pytest
    • ruff
    • git

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Pytest Testing loads about 3.5k tokens when it runs. Until then it costs about 71 tokens; SKILL.md has 688 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~71
When it runs · the whole SKILL.md, loaded when a task matches
~3.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from ArduPilot/MethodicConfigurator at commit 1a6392c, republished under its GPL-3.0 licence (© ArduPilot). 688 words, ~3,542 tokens.

Download SKILL.mdSave it as .claude/skills/pytest-testing/SKILL.md (or your agent's skills folder).
name
pytest-testing
description
Write high-quality BDD pytest tests for the ArduPilot Methodic Configurator. Use when writing new unit tests, creating test fixtures, applying Given-When-Then pattern, testing tkinter frontends, or following the minimal-mocking strategy for backend and business logic.

Pytest Testing Guidelines

Note: This is a comprehensive developer documentation file. For GitHub Copilot repository instructions, see .github/copilot-instructions.md.

For AI Agents and Senior Developers

This document provides comprehensive guidelines for writing high-quality, behavior-driven pytest tests for the ArduPilot Methodic Configurator project. These guidelines ensure consistency, maintainability, and comprehensive test coverage while following industry best practices.

Core Testing Philosophy

1. Senior Developer Mindset
  • Write tests that future developers will thank you for
  • Focus on behavior over implementation details
  • Prioritize maintainability and readability
  • Use minimal, strategic mocking
  • Apply DRY principles consistently
2. Behavior-Driven Development (BDD)
  • Write tests that describe user behavior and business value, not implementation details
  • Use Given-When-Then structure in test descriptions and code comments
  • Focus on what the system should do, not how it does it
  • Test names should read like specifications: test_user_can_select_template_by_double_clicking
3. Test Isolation and Independence
  • Each test should be completely independent and able to run in any order
  • Use fixtures with appropriate scopes (function, class, module, session)
  • Clean up resources properly after tests complete
  • Avoid shared mutable state between tests

All tests MUST follow this structure:

python
def test_descriptive_behavior_name(self, fixture_name) -> None:
    """
    Brief summary of what the test validates.

    GIVEN: Initial system state and preconditions
    WHEN: The action or event being tested
    THEN: Expected outcomes and assertions
    """
    # Arrange (Given): Set up test data and mocks

    # Act (When): Execute the behavior being tested

    # Assert (Then): Verify expected outcomes

🔧 Fixture Guidelines

Required Fixture Pattern

Create reusable fixtures that eliminate code duplication:

python
@pytest.fixture
def mock_vehicle_provider() -> MagicMock:
    """Fixture providing a mock vehicle components provider with realistic test data."""
    provider = MagicMock()

    # Create properly structured mock data matching real object interfaces
    template_1 = MagicMock()
    template_1.attributes.return_value = ["name", "fc", "gnss"]
    template_1.name = "QuadCopter X"
    template_1.fc = "Pixhawk 6C"
    template_1.gnss = "Here3+"

    provider.get_vehicle_components_overviews.return_value = {
        "Copter/QuadX": template_1,
    }
    return provider


@pytest.fixture
def configured_window(mock_vehicle_provider) -> ComponentWindow:
    """Fixture providing a properly configured window for behavior testing."""
    with (
        patch("tkinter.Toplevel"),
        patch.object(BaseWindow, "__init__", return_value=None),
        # Only patch what's necessary for the test
    ):
        window = ComponentWindow(vehicle_components_provider=mock_vehicle_provider)
        window.root = MagicMock()
        return window
Fixture Design Rules
  1. One concern per fixture - Each fixture should have a single responsibility
  2. Realistic mock data - Use data that mirrors real system behavior
  3. Composable fixtures - Allow fixtures to depend on other fixtures
  4. Descriptive names - Fixture names should clearly indicate their purpose
  5. Minimal scope - Use the narrowest scope possible (function > class > module > session)

📝 Test Structure Standards

Test Class Organization
python
class TestUserWorkflow:
    """Test complete user workflows and interactions."""

    def test_user_can_complete_primary_task(self, configured_window) -> None:
        """
        User can successfully complete the primary workflow.

        GIVEN: A user opens the application
        WHEN: They follow the standard workflow
        THEN: They should achieve their goal without errors
        """
        # Implementation
Test Method Requirements
  1. Descriptive names - test_user_can_select_template_by_double_clicking
  2. Single behavior focus - Test one behavior per method
  3. User-centric language - Write from the user's perspective
  4. Complete documentation - Include summary and GIVEN/WHEN/THEN
Assertions
  • Use specific assertions over generic ones
  • Test behavior outcomes not implementation details
  • Group related assertions logically
  • Include meaningful failure messages when helpful
python
# Good - Tests behavior
assert window.selected_template == "Copter/QuadX"
assert window.close_window.called_once()

# Bad - Tests implementation
assert mock_method.call_count == 1

🎭 Mocking Strategy

Minimal Mocking Principle

Only mock what is absolutely necessary:

python
# Good - Minimal mocking
def test_template_selection(self, template_window) -> None:
    template_window.tree.selection.return_value = ["item1"]
    template_window._on_selection_change(mock_event)
    assert template_window.selected_template == "expected_value"

# Bad - Over-mocking
def test_template_selection(self) -> None:
    with patch("tkinter.Tk"), \
         patch("module.Class1"), \
         patch("module.Class2"), \
         patch("module.method1"), \
         patch("module.method2"):
        # Test lost in mocking complexity
Mocking Guidelines
  1. Mock external dependencies (file system, network, databases)
  2. Mock UI framework calls (tkinter widgets, events)
  3. Don't mock the system under test - Test real behavior
  4. Use fixtures for complex mocks - Keep test methods clean
  5. Mock return values realistically - Match expected data types and structures

🏗️ Project-Specific Patterns

Frontend Tkinter Testing
python
# Use template_overview_window_setup fixture for complex UI mocking
def test_ui_behavior(self, template_overview_window_setup) -> None:
    """Test UI behavior without full window creation."""


# Use template_window fixture for component testing
def test_component_behavior(self, template_window) -> None:
    """Test component behavior with configured window."""
Backend/Logic Testing
python
# Use minimal mocking for business logic
def test_business_logic(self, mock_data_provider) -> None:
    """Test core logic with realistic data."""


# Mock only external dependencies
@patch("module.external_api_call")
def test_integration_behavior(self, mock_api) -> None:
    """Test integration points."""
Show full SKILL.md (312 more words)Show less
macOS CI Headless Testing (Tkinter Segfault Guidelines)

Tkinter is extremely buggy and unstable on macOS GitHub Action runners. Without a physical display, forcing UI updates will cause Segmentation Faults (AppKit/HIToolbox crashes) which instantly kill the MacOS Pytest runner. To prevent this, please follow these rules:

  1. Never use .update(): It forces a full event loop evaluation and will crash macOS. Always use .update_idletasks() instead.
  2. Preventing CI Crashes During Setup: Whenever you create a Tkinter window in a test, you must block the main tkinter library from trying to render to a physical screen. Make sure your yield statement stays inside the with patch(...) block so that these overrides don't expire before the test finishes running.
python
@pytest.fixture
def safe_window_fixture(tk_root) -> Generator[MyWindow, None, None]:
    with (
        # Prevent Tkinter DPI scaling calculations from crashing macOS
        patch.object(tk.Toplevel, "winfo_fpixels", side_effect=tk.TclError("no display")),
        # Block macOS C-level screen rendering universally
        patch("tkinter.Misc.update"),
        patch("tkinter.Misc.update_idletasks"),
        patch("tkinter.Misc.wait_visibility"),
        patch("tkinter.Misc.wait_window"),
    ):
        window = MyWindow(tk_root)

        # Follow Point 2
        yield window

- GUI Tests (gui_*.py): Any test simulating physical interaction (e.g., PyAutoGUI) must
explicitly load the CI environment setup at the very top of the file:

from tests.conftest import gui_test_environment  # noqa: F401 # pylint: disable=unused-import
pytestmark = pytest.mark.gui

## 📋 Test Categories

### Required Test Types

1. **User Workflow Tests** - Complete user journeys
2. **Component Behavior Tests** - Individual component functionality
3. **Error Handling Tests** - Graceful failure scenarios
4. **Integration Tests** - Component interaction validation
5. **Edge Case Tests** - Boundary conditions and unusual inputs

### Test Organization

Test files follow specific naming conventions to clearly indicate their purpose and scope:

```text
tests/
├── test_frontend_tkinter_component.py      # BDD UI component unit tests
├── test_backend_logic.py                   # BDD Business logic unit tests
├── gui_*.py                                # pyautogui GUI-focused tests (prefixed with gui_)
├── integration_*.py                        # End-to-end integration tests (prefixed with integration_)
├── acceptance_*.py                         # Acceptance tests (prefixed with acceptance_)
├── unit_*.py                               # Low-level unit tests for coverage purposes (prefixed with unit_)
└── conftest.py                             # Shared fixtures

📊 Quality Standards

Test Quality Metrics
  • Coverage: Aim for 80%+ on core modules
  • Maintainability: Tests should be easy to modify
  • Speed: Test suite should run in < 2 minutes
  • Reliability: Zero flaky tests allowed
Code Review Checklist
  • Tests follow GIVEN/WHEN/THEN structure
  • Fixtures used instead of repeated setup
  • Minimal, strategic mocking applied
  • User-focused test names and descriptions
  • All edge cases covered
  • Error scenarios tested
  • Performance considerations addressed

🚀 Example: Complete Test Implementation

python
class TestTemplateSelection:
    """Test user template selection workflows."""

    def test_user_can_select_template_by_double_clicking(self, template_window) -> None:
        """
        User can select a vehicle template by double-clicking on the tree item.

        GIVEN: A user views available vehicle templates
        WHEN: They double-click on a specific template row
        THEN: The template should be selected and stored
        AND: The window should close automatically
        """
        # Arrange: Configure template selection behavior
        template_window.tree.identify_row.return_value = "template_item"
        template_window.tree.item.return_value = {"text": "Copter/QuadX"}

        # Act: User double-clicks on template
        mock_event = MagicMock(y=100)
        template_window._on_row_double_click(mock_event)

        # Assert: Template selected and workflow completed
        template_window.program_settings_provider.store_template_dir.assert_called_once_with("Copter/QuadX")
        template_window.root.destroy.assert_called_once()

    def test_user_sees_visual_feedback_during_selection(self, template_window) -> None:
        """
        User receives immediate visual feedback when selecting templates.

        GIVEN: A user is browsing available templates
        WHEN: They click on a template row
        THEN: The corresponding vehicle image should be displayed immediately
        """
        # Arrange: Set up selection behavior
        template_window.tree.selection.return_value = ["selected_item"]
        template_window.tree.item.return_value = {"text": "Plane/FixedWing"}

        with patch.object(template_window, "_display_vehicle_image") as mock_display:
            # Act: User selects template
            mock_event = MagicMock()
            template_window._on_row_selection_change(mock_event)
            template_window._update_selection()  # Simulate callback

            # Assert: Visual feedback provided
            mock_display.assert_called_once_with("Plane/FixedWing")

🛠️ Development Workflow

Pre-commit Requirements
  1. Run tests: pytest tests/ -v
  2. Check coverage: pytest --cov=ardupilot_methodic_configurator --cov-report=term-missing
  3. Format with ruff: ruff format
  4. Lint with ruff: ruff check --fix
  5. Type check with mypy: mypy
  6. Advanced type check with pyright: pyright
  7. Style check with pylint: pylint $(git ls-files '*.py')
Test Execution Commands

On Linux systems where the normal display is unavailable, run pytest through the project virtual environment and Xvfb. This is required by GUI-dependent fixtures such as PyAutoGUI:

bash
# Run non-SITL tests with the local virtual environment and a virtual display
PATH="$PWD/.venv/bin:$PATH" xvfb-run -a python -m pytest tests/ -v -m "not sitl and not integration"
bash
# Run all tests with verbose output
pytest tests/ -v

# Run tests with coverage reporting
pytest tests/ --cov=ardupilot_methodic_configurator --cov-report=html

# Run specific test file
pytest tests/test_frontend_tkinter_template_overview.py -v

# Run tests matching pattern
pytest tests/ -k "test_user" -v

# Run tests with performance timing
pytest tests/ --durations=10
Debugging Failed Tests
bash
# Run with detailed output
pytest tests/test_file.py::test_method -v -s

# Run with pdb debugging
pytest tests/test_file.py::test_method --pdb

# Run with custom markers
pytest tests/ -m "slow" -v

🔍 Quality Assurance

Success Criteria
  • ✅ All tests pass consistently
  • ✅ Coverage ≥ 80% on modified modules
  • ✅ Zero ruff/mypy violations
  • ✅ Tests follow behavior-driven structure
  • ✅ Fixtures eliminate code duplication
  • ✅ User-focused test descriptions
  • ✅ Minimal, strategic mocking

Remember: Write tests that make the codebase more maintainable, not just achieve coverage metrics.

© ArduPilot, GPL-3.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .github/skills/pytest-testing of ArduPilot/MethodicConfigurator.

Open the folder on GitHubat commit 1a6392c

Compare with similar skills

Pytest Testing next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Pytest Testing compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Pytest Testing this skillArduPilot/MethodicConfigurator163—~3.5kAutomated safety check: PassGPL-3.0
Adk Verify Snippetsgoogle/adk-python22k—~1.4kAutomated safety check: PassApache-2.0
Hermetic Python Unit TestsdimensionalOS/dimos4.6k—~1.4kAutomated safety check: PassCustom licence
Test GuardamElnagdy/guard-skills1.3k2 repos~2.1kAutomated safety check: PassMIT
Fla Optimization Loopfla-org/flash-linear-attention5.8k—~2.6kAutomated safety check: PassMIT
Pytest Runnersaleor/saleor23k—~251Automated safety check: PassBSD-3-Clause

Similar skills

  • Adk Verify Snippets

    google/adk-python

    Official

    Checks that every Python code block in a Markdown file actually compiles and runs, by extracting each block to a temporary file, executing it in an isolated subprocess, and writing a pass/fail…

    22k GitHub stars~1.4k tokensUpdated today
    Testing & QAAuto-check passed
  • Hermetic Python Unit Tests

    dimensionalOS/dimos

    Rules for writing, fixing and reviewing pytest unit tests that are hermetic: behavior-focused, deterministic, isolated and cheap to run.

    4.6k GitHub stars~1.4k tokensUpdated today
    Testing & QAAuto-check passed
  • Test Guard

    amElnagdy/guard-skills

    Reviews newly written or edited tests against nine rules that cut test bloat, such as mock-heavy checks and near-duplicate cases, before they are committed.

    1.3k GitHub starsUsed in 2 repos~2.1k tokens
    Testing & QAAuto-check passed
  • Fla Optimization Loop

    fla-org/flash-linear-attention

    Disciplined, reproducible loop for making an FLA kernel faster (Triton, Gluon, TileLang, CuTe) without ever breaking or gaming correctness.

    5.8k GitHub stars~2.6k tokensUpdated yesterday
    Testing & QAAuto-check passed
  • Pytest Runner

    saleor/saleor

    Run pytest tests with automatic virtual environment activation. Use this skill whenever running tests, executing pytest, or when asked to "run tests", "test…

    23k GitHub stars~251 tokensUpdated yesterday
    Testing & QAAuto-check passed
  • Port Node Red Node

    oldrev/edgelinkd

    Port a Node-RED node into EdgeLinkd the way this repo does it: implement the node in Rust under crates/core/src/runtime/nodes, mirror Node-RED's mocha spec as pytest tests under tests/, register the…

    121 GitHub stars~3k tokensUpdated yesterday
    Testing & QAAuto-check passed

More from ArduPilot/MethodicConfigurator

All 11 skills in this repo
  • Update Gui Translations

    ArduPilot/MethodicConfigurator

    Update existing GUI translations using AI assistance. An agent skill from ArduPilot/MethodicConfigurator.

    163 GitHub stars~1.5k tokensUpdated yesterday
    Auto-check passed
  • Add UI Translation

    ArduPilot/MethodicConfigurator

    Add a new translation language to the application. An agent skill from ArduPilot/MethodicConfigurator.

    163 GitHub stars~1.8k tokensUpdated yesterday
    Auto-check passed
  • Architecture Validation

    ArduPilot/MethodicConfigurator

    Validate and update ARCHITECTUREn.md files against actual source code implementation.

    163 GitHub stars~3.8k tokensUpdated yesterday
    Auto-check passed
  • Codebase Analysis

    ArduPilot/MethodicConfigurator

    Analyze the codebase structure and count lines of code by category using cloc.

    163 GitHub stars~2.2k tokensUpdated yesterday
    Auto-check: notes
  • Configuration Steps Reorder

    ArduPilot/MethodicConfigurator

    Add, delete, or re-order configuration steps in configurationsteps.json.

    163 GitHub stars~1.3k tokensUpdated yesterday
    Auto-check passed
  • Sitl Testing

    ArduPilot/MethodicConfigurator

    Set up and run SITL integration tests for backendflightcontroller.py.

    163 GitHub stars~1.7k tokensUpdated yesterday
    Auto-check passed

Works with

Categories

Questions about Pytest Testing

What does Pytest Testing do?

Write high-quality BDD pytest tests for the ArduPilot Methodic Configurator. Pytest Testing is an agent skill from ArduPilot/MethodicConfigurator. Write high-quality BDD pytest tests for the ArduPilot Methodic Configurator.

When should I use Pytest Testing?

Pytest Testing fits situations like: writing new unit tests; creating test fixtures; applying Given-When-Then pattern; testing tkinter frontends.

How do I install Pytest Testing in Claude Code?

Run `npx skills add ArduPilot/MethodicConfigurator --skill pytest-testing -a claude-code`. Or copy the skill folder (.github/skills/pytest-testing in ArduPilot/MethodicConfigurator) into .claude/skills/pytest-testing in your project. Claude Code loads it when a task matches its description.

How do I install Pytest Testing in Codex?

Run `npx skills add ArduPilot/MethodicConfigurator --skill pytest-testing -a codex`. Or copy the skill folder (.github/skills/pytest-testing in ArduPilot/MethodicConfigurator) into .agents/skills/pytest-testing in your project. Codex loads it when a task matches its description.

Can I use Pytest Testing in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ArduPilot/MethodicConfigurator --skill pytest-testing -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/pytest-testing, .gemini/skills/pytest-testing, .github/skills/pytest-testing and .opencode/skills/pytest-testing in your project.

What does Pytest Testing need to run?

Going by SKILL.md and its folder, Pytest Testing needs the command-line tools its instructions call (pytest, ruff and git). Our summary lists: Python 3.

Does Pytest Testing access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Pytest Testing safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Pytest Testing use?

Pytest Testing is published under the GPL-3.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Pytest Testing use?

About 3.5k tokens (SKILL.md is roughly 14k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Pytest Testing?

Skills that share tags, products or a category with Pytest Testing: Adk Verify Snippets (google/adk-python, 22k stars), Hermetic Python Unit Tests (dimensionalOS/dimos, 4.6k stars), Test Guard (amElnagdy/guard-skills, 1.3k stars) and Fla Optimization Loop (fla-org/flash-linear-attention, 5.8k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Pytest Testing?

ArduPilot (a GitHub organization) maintains it in ArduPilot/MethodicConfigurator, which has 163 GitHub stars. The repository holds 11 skills in this directory. The repository was last updated on October 6, 2026.

Source: ArduPilot/MethodicConfigurator on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.