* feat: global `frappe.in_test` flag
* feat: helper utility to toggle `frappe.in_test`
* fix: use `toggle_test_mode` util
* fix: use `frappe.in_test`
* chore: add comment explaining global `in_test`
* chore: ignore commit replacing flag usage
* test: temporarily disable `frappe.in_test`
this worked earlier because flag was set in werkzeug.local which was separate for API test client
* test: add comment explaining change
Next to zero adoption after introduction, just noise in codebase.
I don't see any point in arguing about purity of test cases when
existence and quality of test cases is usually the bigger problem.
Dropped using semgrep
Not all single doctypes are settings, so this is better. Implicit
caching is fine, same is done for `db` APIs on singles. We *should* aim
for 100% correctness of caching implementation, especially for singles.
Thanks to @netchampfaris for the suggestion.
* feat: get_settings
get_cached_value doesn't work well with singles because you either need
to pass `None` or repeat doctype name... both are awekward and easy to
shoot yourself in foot with.
* refactor: Use cached settings
As per review, renamed chrome_pdf_generator to pdf_generator and made it a select field.
- default option available for select is wkhtmltopdf.
- default for new print formats is wkhtmltopdf.
- print designer on install adds a new option ( chrome ) to the select field.
- added patch to update existing print format to wkhtmltopdf.
* refactor: toml test records for readability
* fix: maintain backwards compatibility
* refactor: transform in-tree records
* chore: don't use deprecated functions (treewide)
* chore: revert migration of tests which depend on old test records list
* feat: add cls.globalTestRecords on IntegrationTestCase
* 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
there was a edge case where when print format beta was set to default which never ran code which sets the size for container that holds format.
fixed that by make iframe height to 100vh minus navbar and heading on load of beta print format
* chore: warn if wkhtmltopdf is invalid
wkhtmltopdf ( with patched qt ) is required to generate pdfs properly.
when user clicks on PDF, pdf will be generated and downloaded.
however, on print preview page warning will be shown.
* chore: refactor based on review comments
* chore: return False incase of exception
* chore: refactor and better naming
Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
Replaced Print Format Builder Beta link in print-view to Print Designer.
if App is installed it opens Print Designer, if not it opens Frappe Cloud Marketplace Link.
- feat: Allow script injection into header/footer.html to allow manipulation of styles using page numbers/args received by wkhtmltopdf
- misc: also validate letterhead scripts
- Include scripts in printview as well as pdf
- Add helper instructions & re-arrange fields
* fix: Only allow standard print format modification in migrate
AFAIK only valid use case is fixtures and there too it should avoid
"standard".
* chore: typo
Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
---------
Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>