* refactor: prefer staticmethod decorator
* refactor: add cm register utility and keep cms in one file
* refactor: enter safe_exec enabled context (treewide)
* refactor: move trace fields to the other test context managers
* chore: marke all test_runner functions for deprecation
* chore: mark some tests.utils functions for deprecation (moved)
* chore: mark traced_field_conext for deprecation (moved)
* chore: placate semgrep in dumpster
* fix: show deprecation warnings per module in tests (incl. from dumpster)
* chore: remove use of deprecated functions from tests
* 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
We set defaults on creation of new doc but when you append a new child
doc on existing document it doesn't seem to set the defaults.
This seems like a bug and not a deliberate choice.
* fix: raise exception if doc before save is not found
* test: ensure error is raised when trying to save new doc using `doc.save()`
* chore: add comment explaining condition
* test: clearer name and docstring
### BREAKING CHANGE
#### Datetime, Date and Time fields will always be cast to respective objects in `setattr`, this will ensure uniformity while accessing the values, no more `getdate`, `get_datetime`, `to_timedelta` wrapper.
- While importing data, the framework does check for `set_only_once`.
- In normal case scenarios, this will work flawlessly since most date fields might not be set_only_once.
- But in Subscription, the date field is set to `set_only_once` and in `after_insert`, `document.save` is called, and while doing so, `set_only_once` is checked [here](1944a547f9/frappe/model/document.py (L566)).
-This works fine if the data imported is in the correct format.
- If the date's data is not in the correct format, the framework throws an error.
- for eg `06-02-2022 00:00:00 != 06-02-2022`
- fixes [Issue/#15370](https://github.com/frappe/frappe/issues/15370)
> no-docs
* chore: warn about missing scheduler / doc events
* fix: pass list instead of filter
filter can only be iterated upon once
* refactor: many typehints in __init__.py