* 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
* feat(safe_exec): allow usage of `print()`
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
* refactor(system_console): update description to mention `print()` instead of `log()`
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
* feat: unconditionally add debug logs to response if present
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
* chore(safe_exec): add in a test for running `print()` within safe_exec
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
* fix(safe_exec): ignore warning
RestrictedPython warns us if we call `print()` don't use their `printed` variable
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
* feat: store debug logs from scheduled jobs
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
* fix: avoid ignoring warnings, disabled in prod anyway
* chore: remove unnecessary logging
This can be moved to level 2 when required
---------
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
Co-authored-by: Ankush Menat <ankush@frappe.io>
- Move the config to bench level and not site level because, server
script "threat model" requires consent from a bench owner and not
individual site.
- While this is a breaking change which people may not like, we believe
it's essential to improve security model of Frappe.
* Remove six for PY2 compatability since our dependencies are not, PY2
is legacy.
* Removed usages of utils from future/past libraries since they are
deprecated. This includes 'from __future__ ...' and 'from past...'
statements.
* Removed compatibility imports for PY2, switched from six imports to
standard library imports.
* Removed utils code blocks that handle operations depending on PY2/3
versions.
* Removed 'from __future__ ...' lines from templates/code generators
* Used PY3 syntaxes in place of PY2 compatible blocks. eg: metaclass