awesome-repositories.com
博客
awesome-repositories.com

通过 AI 驱动的搜索,发现最优秀的开源仓库。

探索精选搜索开源替代品自托管软件博客网站地图
项目关于排名机制媒体报道MCP 服务器
法律隐私政策服务条款
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
·
pytest-dev avatar

pytest-dev/pytest

0
View on GitHub↗
13,645 星标·3,024 分支·Python·mit·8 次浏览pytest.org↗

Pytest

pytest 是一个 Python 测试框架,提供了一个用于发现和执行测试套件的命令行运行器。它构建在模块化架构之上,使用标准语言断言来验证代码正确性,自动检查表达式以提供详细的失败报告,而无需专门的断言方法。

该框架的独特之处在于其依赖注入系统,通过自动解析资源并将其注入测试函数来管理设置和拆卸逻辑。它还具有基于钩子(hook)的插件架构,允许对测试生命周期(包括收集、执行和报告)进行深度定制。这些功能由动态参数化(从单个定义生成多个测试实例)和持久状态缓存(支持选择性地重新运行失败测试)提供支持。

除了核心执行模型外,该项目还提供了一套全面的工具来管理测试环境,包括输出捕获、日志管理和警告验证。它通过临时文件管理、对象打补丁以及原生执行其他框架现有测试套件等功能支持复杂的测试场景。配置通过集中式文件处理,允许对测试发现、过滤和执行行为进行细粒度控制。

该项目作为标准 Python 包分发,并包含有关其配置、插件系统和命令行界面的详尽文档。

Features

  • Test Frameworks - Provides a testing framework for Python that uses standard language assertions and a modular fixture system to verify code correctness.
  • Dependency Injection - Provides a mechanism for managing setup and teardown logic by injecting reusable resources and state into test functions as arguments.
  • Data-Driven Parametrization - Generates multiple test instances from a single function definition by injecting varied input datasets during the collection phase.
  • Test Execution Runners - Provides a command-line tool that automatically discovers and executes test suites based on naming conventions and configuration files.
  • Test Fixture Systems - Provides a powerful dependency injection system that automatically resolves and injects test resources as function arguments.
  • Fixture Definitions - Creates setup and teardown logic that can be injected into test functions via dependency injection or automatic activation.
  • Execution Assertions - Uses standard language assertions to validate code behavior and automatically inspects intermediate values to provide detailed failure reports.
  • CLI Test Runners - Automatically identifies and executes test files and functions based on naming conventions within the project directory structure.
  • Assertion Decomposition - Inspects failing expressions automatically to provide descriptive error messages without requiring specialized assertion methods.
  • Exception Verification - Ensures that specific code blocks raise the correct error types and provides access to exception details for inspection.
  • Plugin Architectures - Provides a modular system that allows third-party extensions to customize test collection, execution, and reporting through hooks.
  • Lifecycle Hooks - Allows plugins to intercept and modify the test lifecycle, including directory collection, option parsing, and reporting.
  • Hook-Based Plugin Systems - Features a hook-based plugin architecture that allows deep customization of the test lifecycle through event-driven registration.
  • Test Configuration - Centralizes project-wide testing settings and environment preferences within a dedicated configuration file.
  • Assertion Rewriting - Provides detailed failure reports by automatically inspecting expressions in standard language assertions.
  • Test Lifecycle and Execution Control - Controls the scope and cleanup of test resources across functions, classes, modules, or entire sessions to ensure reliable execution.
  • Test Case Generators - Implements dynamic test generation logic to determine test parameters or scopes based on runtime conditions or command-line options.
  • 代码质量工具 - Framework for writing and running Python tests.
  • 开发者工具 - Scalable testing framework.
  • Python Packages - General testing framework.
  • Python Projects - Listed in the “Python Projects” section of the Awesome For Beginners awesome list.
  • Testing Ecosystems - A mature framework for writing scalable tests in Python.
  • 测试框架 - Scales Python testing from small to complex.
  • Testing Tools - Listed in the “Testing Tools” section of the Awesome Python awesome list.
  • Recursive Discovery Engines - Automatically traverses directory structures to identify and collect test modules based on naming conventions.
  • Framework Extensions - Implements hooks to customize command-line arguments, configuration parsing, and the overall test collection and execution lifecycle.
  • Assertion Rewriters - Modifies source code during import to inject detailed diagnostic information into standard language assertions for improved failure reporting.
  • Conditional Skipping - Prevents execution of specific tests, classes, or modules based on runtime conditions, environment settings, or missing dependencies.
  • Parametrized Fixtures - Configures fixture functions to run multiple times with different parameters, allowing tests to consume varied setup states.
  • Test Suite Filters - Restricts test discovery by excluding specific modules, classes, or functions based on file patterns, markers, or explicit deselection criteria.
  • State Persistence - Saves and retrieves execution metadata and test results on disk to enable selective re-running of failed tests across sessions.
  • Temporary Directory Managers - Automates the creation and cleanup of temporary directories for tests, with configurable retention policies for debugging.
  • Plugin Integrations - Integrates third-party plugins automatically upon installation to add specialized functionality like coverage reporting or distributed execution.
  • Plugin Distributions - Registers plugins through package metadata so they are automatically discovered and loaded by the testing environment.
  • Test State Persistence - Stores execution metadata and test results on disk to enable selective re-running of failed tests across sessions.
  • Warning Verification Utilities - Verifies that specific code blocks trigger expected warnings, matching messages against literal strings or regular expressions.
  • Test Annotations - Attaches custom or built-in attributes to test functions, classes, or modules to organize them for selective execution.
  • Expected Failure Markers - Identifies tests known to fail so they are reported separately from regressions while allowing them to run.
  • Legacy Framework Adapters - Executes existing test suites written for other frameworks natively without requiring code modifications or refactoring.
  • Project Root Definitions - Establishes a stable base directory for test discovery and plugin state storage to ensure consistent identification of test nodes.
  • Test Logging Utilities - Automatically captures log messages during test execution and displays them in the console output when a test fails.
  • Plugin Lifecycle Management - Controls the activation and deactivation of plugins through command-line flags, environment variables, or configuration files.
  • Marker Registrations - Declares metadata tags for tests to ensure they are recognized by the system and appear in documentation.
  • TOML Configuration Support - Supports project configuration using native TOML files for structured and readable settings.
  • Runtime State Modifiers - Overrides attributes, environment variables, or system paths during test execution and automatically restores the original state afterward.
  • Test Patching Utilities - Modifies attributes, dictionary items, or environment variables temporarily during a test and automatically restores them afterward.
  • Local Plugin Implementations - Defines directory-specific hook implementations in configuration files to customize test execution behavior for specific subdirectories.
  • Warning Issuance Systems - Confirms that specific code paths trigger expected warnings to ensure proper handling of deprecated or problematic features.
  • Dependency Warning Filters - Configures global or test-specific rules to ignore, display, or promote specific warnings to errors.
  • Doctest Runners - Runs code examples embedded in documentation files or source code docstrings as part of the automated test suite.
  • Test Isolation - Provides utilities to create temporary directories and execute tests in isolation for plugin development.
  • Subtest Reporters - Supports running multiple assertions within a single test function and reporting each failure independently.
  • Test Grouping Utilities - Groups related test functions into classes to improve structure and enable shared configuration or resource management.
  • Transient Failure Reruns - Re-executes tests that fail during a run to mitigate the impact of transient issues and improve build reliability.

Star 历史

pytest-dev/pytest 的 Star 历史图表pytest-dev/pytest 的 Star 历史图表

AI 搜索

探索更多 awesome 仓库

用简单的语言描述您的需求 —— AI 将根据相关性为您从数千个精选开源项目中进行排序。

Start searching with AI

常见问题解答

pytest-dev/pytest 是做什么的?

pytest 是一个 Python 测试框架,提供了一个用于发现和执行测试套件的命令行运行器。它构建在模块化架构之上,使用标准语言断言来验证代码正确性,自动检查表达式以提供详细的失败报告,而无需专门的断言方法。

pytest-dev/pytest 的主要功能有哪些?

pytest-dev/pytest 的主要功能包括:Test Frameworks, Dependency Injection, Data-Driven Parametrization, Test Execution Runners, Test Fixture Systems, Fixture Definitions, Execution Assertions, CLI Test Runners。

pytest-dev/pytest 有哪些开源替代品?

pytest-dev/pytest 的开源替代品包括: thomhurst/tunit — TUnit is a comprehensive C# testing framework, mocking library, and fluent assertion tool. It utilizes source… mochajs/mocha — Mocha is a JavaScript test runner and framework designed to execute automated test suites across multiple runtimes,… vitest-dev/vitest — Vitest is a high-performance testing framework designed for JavaScript and TypeScript applications. It provides an… microsoft/playwright — Playwright is a comprehensive browser automation framework designed for end-to-end testing and web workflow… mobile-dev-inc/maestro — Maestro is a declarative mobile and web UI automation framework designed for end-to-end testing. It operates by… onsi/ginkgo — Ginkgo is a behavior-driven development testing framework, assertion library, and test runner for Go. It provides a…

Pytest 的开源替代方案

相似的开源项目,按与 Pytest 的功能重合度排序。
  • thomhurst/tunitthomhurst 的头像

    thomhurst/TUnit

    3,744在 GitHub 上查看↗

    TUnit is a comprehensive C# testing framework, mocking library, and fluent assertion tool. It utilizes source generation for test discovery and mock creation, ensuring compatibility with Native AOT and IL trimming by eliminating the need for runtime reflection and proxies. The framework provides specialized capabilities for integration testing, including the management of distributed application lifecycles, isolated database schemas, and the correlation of telemetry and logs across process boundaries via OTLP. It also includes an HTTP testing utility to intercept network exchanges and mock AP

    C#csharpdotnettest
    在 GitHub 上查看↗3,744
  • mochajs/mochamochajs 的头像

    mochajs/mocha

    22,967在 GitHub 上查看↗

    Mocha is a JavaScript test runner and framework designed to execute automated test suites across multiple runtimes, including Node.js and web browser environments. It functions as a pluggable testing tool for organizing and validating unit, integration, and functional tests. The project distinguishes itself through a plugin-based extension interface that allows for custom functionality and reporting. It supports a multi-runtime approach, enabling the same test suite to run in different JavaScript environments, and includes a watch mode that monitors the filesystem to trigger automatic test re

    JavaScriptbddbrowserjavascript
    在 GitHub 上查看↗22,967
  • vitest-dev/vitestvitest-dev 的头像

    vitest-dev/vitest

    15,970在 GitHub 上查看↗

    Vitest is a high-performance testing framework designed for JavaScript and TypeScript applications. It provides an integrated environment that supports unit, integration, and browser-based testing, allowing developers to execute test suites natively without requiring separate build steps or complex configuration. The project distinguishes itself through a highly optimized execution model that leverages worker-thread isolation and on-demand module transformation to provide rapid feedback. It includes a comprehensive suite of mocking and spying utilities that allow for the interception of depen

    TypeScripttesttesting-toolsvite
    在 GitHub 上查看↗15,970
  • microsoft/playwrightmicrosoft 的头像

    microsoft/playwright

    91,074在 GitHub 上查看↗

    Playwright is a comprehensive browser automation framework designed for end-to-end testing and web workflow automation. It provides a unified API to drive web applications across multiple browser engines, enabling developers to simulate complex user interactions, perform web scraping, and validate application behavior in consistent, isolated environments. The framework distinguishes itself through a web-first testing paradigm that prioritizes stability and resilience. By utilizing an auto-waiting actionability engine and accessibility-tree-based locators, it eliminates common sources of test

    TypeScriptautomationchromechromium
    在 GitHub 上查看↗91,074
  • 查看 Pytest 的所有 30 个替代方案→