lorairo-test-generator

Generate pytest unit, integration, and GUI tests for LoRAIro with fixtures, mocks, and coverage.

1|Updated May 3, 2024
One-click install
npx skills add https://github.com/NEXTAltair/LoRAIro --skill lorairo-test-generator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: lorairo-test-generator
Source: https://github.com/NEXTAltair/LoRAIro/tree/main/.claude/skills/lorairo-test-generator
Command: npx skills add https://github.com/NEXTAltair/LoRAIro --skill lorairo-test-generator

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pytest, pytest-qt, pytest-cov.

What problem does it solve?

This Skill automates the time-consuming and often complex task of writing comprehensive tests for Python applications, especially those with GUI components. It streamlines test generation, ensuring high code quality and significantly reducing manual testing effort.

Core Features & Use Cases

  • Pytest Test Generation: Create unit, integration, and GUI tests using pytest, complete with proper fixtures and mocks for isolated and reliable testing.
  • PySide6 GUI Testing: Leverage pytest-qt to write robust and interactive tests for PySide6 UI components, ensuring a smooth user experience.
  • Coverage Reporting: Generate detailed coverage reports to ensure a minimum of 75% code coverage, helping identify untested areas and improve code quality.
  • Use Case: After implementing a new image processing service, use this Skill to generate unit tests for its core logic, integration tests for its database interactions, and GUI tests for its user interface, all while tracking code coverage.

Quick Start

Example: Generate a basic unit test for a function

File: tests/utils/test_calculator.py

import pytest from src.lorairo.utils.calculator import add

@pytest.mark.unit def test_add_numbers(): assert add(1, 2) == 3 assert add(-1, 1) == 0 assert add(0, 0) == 0

Example: Run unit tests with coverage

uv run pytest -m unit --cov=src --cov-report=html

Frequently Asked Questions about lorairo-test-generator

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate unit tests for Python code with pytest?

Unit tests with pytest isolate and validate individual functions or methods. This Skill generates pytest unit tests with proper fixtures and mocks for business logic, ensuring each component works independently before integration testing.

Can I test PySide6 GUI components with pytest?

Yes, pytest-qt extends pytest to test PySide6 UI interactions and state changes. This Skill generates GUI tests using pytest-qt fixtures and mocks, enabling reliable automated testing of window behavior, signals, and user interactions.

How do I measure code coverage and ensure 75% minimum coverage?

Code coverage tracks which lines execute during testing; pytest-cov generates coverage reports showing gaps. This Skill produces unit, integration, and GUI tests configured to report coverage metrics and identify untested areas.

What's the difference between unit, integration, and GUI tests?

Unit tests validate single functions in isolation; integration tests verify multi-component workflows; GUI tests interact with user interface elements. This Skill generates all three types with appropriate fixtures, mocks, and pytest-qt for PySide6 components.

Do I need to write test fixtures and mocks manually?

Fixtures and mocks reduce test coupling and isolate code under test. This Skill automatically structures tests with proper pytest fixtures and mocks for business logic and database interactions, eliminating manual setup boilerplate.

When should I run integration tests versus unit tests?

Unit tests run frequently during development for fast feedback; integration tests validate workflows after units are stable. This Skill generates both types with pytest markers, allowing selective execution via `pytest -m unit` or `pytest -m integration`.