Currently one test runner takes significantly longer than another. This
is entirely due to test_commands.py which needs to create new site and
do backup/restore tests etc. All of which are far far slower than other
tests.
This is middle ground between caching it completely and requiring a
restart/signal to reload vs always reloading it.
I don't know any use cases that can break from this, nowhere in code
configs should be expected to reload instantly.
This change is only applied to requests for now
* chore: remove verbose output from test runner
This is same output that's shared by test runner in different format?
This makes it annoying to scroll through when just running single test
locally.
* fix: Remove clutter from test output
Test records don't change after first run.
Tests are executed many many times locally
* test: retry flaky postgres backup 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
BREAKING: return values of bench execute are not quoted anymore
For example, `bech execute frappe.bold --arg 'hi'`
- now returns: `<strong>hi</strong>`
- instead of: `"<strong>hi</strong>"`
(single quotes would force it to lowercase)
Also unconditionally create a new user while running tests - we're gonna be dropping the test site
Don't pass a `None` value to bench cli
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
* feat: `describe-database-table` to get stats about a table
This provides description of table, indexes, total row count in machine
parseable format.
Towards https://github.com/frappe/press/issues/1265
* Update test_commands.py
* fix: procure db config from single authority
ensures that configuration is uniformely procured from local.conf
instead of making use of hard to audit multilevel fallback logic
Implementation Note:
- `get_db(host, port, user, password)` was stripped of any optional
argument and therefrom all errors where fixed.
- All occurances of `grep 'frappe.db.db_'` where changed to
`frappe.conf.db_`
* fix: revert unnecessary breaking changes
This avoids having to manipulate config files in brittle bash
entrypoints that need to react to dynamic service discovery.
This significantly improves the operability of various bench sites.
In command tests if connection is active then due to repeatable read
isolation you will continue to read old data which might be modified by
the command you're trying to test.
It makes sense to end transaction after each command execution here.
[skip ci]
This isn't working because it uses update_site_config command which
attemts to find site_dir to create a lock which doesn't work when site
isn't init-ed.
refactor: clean up code to py39+ supported syntax
- f-strings instead of format
- latest typing support instead of pre 3.9 TitleCase
- remove UTF-8 declarations.
- many more changes
Powered by https://github.com/asottile/pyupgrade/ + manual cleanups