seitime-frappe/frappe/testing
Ankush Menat 098a0851c6
ci: Fix coverage reporting (again) (#38849)
* chore: remove _decorate_all_methods_and_functions_with_type_checker

No one understands this runtime magic anymore.

* build: Bump coverage.py to latest

* test: Skip github in coverage reporting

* test: Print traceback from all threads when test is stuck

* ci: Enable coverage in server side tests

* ci: Always enable coverage

It's cheap in recent python versions, our reasons for selectively
disabling aren't valid anymore.

* ci: Disable stderr capturing

* ci: Use default buffer behaviour in unittest runner

* ci(coverage): Set concurrency to multiprocessing

We do use multiprocessing, perhaps the patches aren't concurrectly
handled?

* ci(coverage): Try parallel run

* fix: Apply subprocess patch

* ci: Don't start web server with coverage

Causes deadlock for some reason. We don't actually report it either.

* ci: only submit UI coverage if ran

* test: remove aggresive stuck test checking

* ci: disable UI coverage

(for now)
2026-04-24 16:05:14 +05:30
..
__init__.py Testing Module (#28000) 2024-10-07 09:46:49 +02:00
config.py refactor: support failfast and minor changes 2025-06-05 09:23:03 +05:30
discovery.py fix: finer grained test categorization of legacy frappe test case (#28387) 2024-11-13 11:30:09 +01:00
environment.py ci: Fix coverage reporting (again) (#38849) 2026-04-24 16:05:14 +05:30
loader.py refactor: support failfast and minor changes 2025-06-05 09:23:03 +05:30
README.md Testing Module (#28000) 2024-10-07 09:46:49 +02:00
result.py refactor: support failfast on parallel test runner 2026-02-27 16:13:09 +05:30
runner.py ci: Fix coverage reporting (again) (#38849) 2026-04-24 16:05:14 +05:30
utils.py Testing Module (#28000) 2024-10-07 09:46:49 +02:00

Frappe Testing Module

This module provides a comprehensive framework for running tests in Frappe applications. It includes functionality for test discovery, execution, result reporting, and environment setup.

Key Components

  • TestConfig: Configuration class for customizing test execution
  • TestRunner: Main class for running test suites with additional Frappe-specific functionality
  • TestResult: Custom test result class for improved output formatting and logging
  • discover_all_tests: Function to discover all tests in specified Frappe apps
  • discover_doctype_tests: Function to discover tests for specific DocTypes
  • discover_module_tests: Function to discover tests in specific modules

Usage

This module is typically used by Frappe's CLI commands for running tests, but can also be used programmatically for custom test execution scenarios.

For detailed information about each component, please refer to the well-commented code in the following files:

Example

from frappe.testing import TestConfig, TestRunner, discover_all_tests

config = TestConfig(failfast=True, verbose=2)
runner = TestRunner(cfg=config)
discover_all_tests(['my_app'], runner)
runner.run()

For more detailed information about each component and its functionality, please refer to the docstrings and comments in the respective files.