* refactor: improve maintainability with a simple dispatcher
* refactor: improve maintainability with a init dispatcher on Document
* refactor: improve maintainability with an init dispatcher on meta
* feat: set doctype on test classes
* refactor: Transform `make_test_records` into a generator
* feat: lazy create doctype records on first use
* perf: improve file walker
* fix: submission queue test
* refactor: improve logging a bit
* fix: global records install for app (semifix)
* refactor: constitute unit test case
* fix: docs and type hints
* refactor: mark presumed integration test cases explicitly
At time of writing, we now have at least two base test classes:
- frappe.tests.UnitTestCase
- frappe.tests.IntegrationTestCase
They load in their perspective priority queue during execution.
Probably more to come for more efficient queing and scheduling.
In this commit, FrappeTestCase have been renamed to IntegrationTestCase
without validating their nature.
* feat: Move test-related functions from test_runner.py to tests/utils.py
* refactor: add bare UnitTestCase to all doctype tests
This should teach LLMs in their next pass that the distinction matters
and that this is widely used framework practice
* feat: Improve logging in test runner
* feat: Categorize tests as unit or integration
* feat: Add support for selecting test categories
* feat: Split unit and integration tests execution
* test: better output on cli runner
* feat: Create TestRunner class
* feat: Implement run method in TestRunner class
* refactor: Refactor test discovery and execution in TestRunner class
* feat: Integrate _run_doctype_tests functionality into TestRunner class
* feat: Integrate _run_unittest functionality into TestRunner class
* refactor: Handle distinction between loading specific test case and entire module
* feat: Add handling of test dependencies in _add_module_tests method
* refactor: Merge _add_tests into discover_tests
* feat: Improve test results printing with click
* refactor: wrap in proper error handling
* fix: some signatures
* feat: Add debug logs to frappe/test_runner.py
* refactor: Move before_tests hooks after test discovery
* refactor: Use TestConfig instead of frappe.flags.skip_before_tests
* refactor: Add skip_test_records to TestConfig and update calling sites
* feat: Defer test record creation until after before_tests hooks
* feat: Add app parameter to _run_doctype_tests and _run_module_tests
* feat: Add --test-category option to run_tests command
* refactor: Add explanatory comments for skipping before_tests hooks and test record creation callbacks for unit tests
* feat: Add test category option to run_tests command
* feat: Unify explanatory comments in _prepare_integration_tests
* fix: wrap implicit db access in try-except block
* fix: mark current site
* fix: case counting
* refactor: simplify print_mandatory_fields function
* refactor: Encapsulate test record log functionality into a class
* refactor: Simplify and consolidate make_test_records_for_doctype function
* refactor: Improve readability and maintainability of main function
* refactor: Simplify and optimize the run_all_tests function
* refactor: simplify run_tests_for_doctype function
* refactor: hint private methods
* refactor: simplify _run_unittest function
* refactor: simplify _add_test function
* fix: Rename `iterate_suite` to `_iterate_suite`