python-test-generator

Generate pytest test suites for FastAPI/SQLAlchemy projects with testcontainers.

7|1|Updated Feb 10, 2026
One-click install
npx skills add https://github.com/Neko1313/casbin-fastapi-decorator --skill python-test-generator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-test-generator
Source: https://github.com/Neko1313/casbin-fastapi-decorator/tree/main/.agents/skills/python-test-generator
Command: npx skills add https://github.com/Neko1313/casbin-fastapi-decorator --skill python-test-generator

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pytest, pytest-asyncio, pytest-cov, pytest-randomly, pytest-xdist, testcontainers, polyfactory, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill automates the generation of comprehensive test suites for FastAPI/SQLAlchemy projects, reducing the time and effort required to write and maintain tests.

Core Features & Use Cases

  • Test Suite Generation: Automatically generates test suites for FastAPI/SQLAlchemy projects using pytest, testcontainers, polyfactory, and pytest-asyncio.
  • Integration and Unit Tests: Generates both integration and unit tests, ensuring comprehensive coverage of the application.
  • Use Case: Ideal for developers who need to quickly set up test infrastructure for new projects or enhance existing test suites.

Quick Start

Use the python-test-generator skill to generate a test suite for your FastAPI/SQLAlchemy project by providing the list of models, endpoints, services, and container needs.

Frequently Asked Questions about python-test-generator

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

FAQPage Schema
How do I generate a test suite for a FastAPI and SQLAlchemy project?

To generate a test suite for a FastAPI and SQLAlchemy project, provide your list of models, endpoints, services, and container needs to automate test creation. This process uses pytest, testcontainers, and polyfactory to handle model creation, endpoint testing, and service verification.

What do I need to set up FastAPI SQLAlchemy test generation with pytest?

FastAPI SQLAlchemy test generation requires Python 3.11+, Docker, and specific pytest environments including pytest-asyncio, pytest-cov, pytest-randomly, and pytest-xdist to execute the automated test suite creation. You also need testcontainers and polyfactory installed.

Why use polyfactory and testcontainers for FastAPI unit and integration tests?

Polyfactory and testcontainers are used for FastAPI tests to isolate dependencies and manage test data generation. Testcontainers provides ephemeral Docker environments for integration testing, while polyfactory automates mock model creation for comprehensive unit test coverage.

Can I use pytest-asyncio and pytest-xdist to run generated FastAPI tests concurrently?

Yes, the generated test suite includes pytest-asyncio and pytest-xdist dependencies to support asynchronous test execution and distributed parallel runs. This allows you to run FastAPI and SQLAlchemy tests concurrently to reduce overall suite execution time.

What are the limitations of automating SQLAlchemy FastAPI test suite generation?

Automating SQLAlchemy FastAPI test suite generation requires Docker for testcontainers and Python 3.11 or higher. You must supply the specific lists of models, endpoints, and services beforehand, limiting its use for dynamically changing or undocumented project structures.