Commit graph

297 commits

Author SHA1 Message Date
David Arnold
7e453ea515
Testing Module (#28000)
* refactor: add create_handler alongside create_logger

* fix: bench helper click exceptions for --help (2nd attempt)

* fix: increase logging level missing test records

* fix: reorganize test runner into testing module and refine logging

* fix: semgrep complaint

* chore: remove unused code; only keep deprecation proxies

* fix: import statements

* fix: output & string processing
2024-10-07 09:46:49 +02:00
David Arnold
fd65584c40
Test Runner 3 b (cleanup) (#27999)
* refactor: Move TestConfig.categories to TestRunner.categories

* fix: app addTest

* fix: run with app arg

* fix: refactor simplify

* fix: run_before_test_hooks signature

* fix: python test module discovery

* fix: app test execution in series
2024-10-06 16:55:41 +00:00
David Arnold
c2c9d9062a
Testing Improvements 3 (#27995)
* 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)
2024-10-06 15:04:47 +00:00
David Arnold
e39ecfa274
refactor: Test runner 2 (#27987)
* 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
2024-10-05 16:37:19 +00:00
David
f0ba65eb9b
ci: improve reporting 2024-10-04 15:22:49 +02:00
Corentin Forler
bea742f624
fix: Evaluate bench execute args for each site 2024-09-30 14:46:54 +02:00
David
202cce8a0d
refactor: type hint cli context 2024-09-13 17:25:43 +02:00
David Arnold
40f2387780
Merge pull request #27763 from frappe/fix/correct-execute-command
fix!: execute command
2024-09-13 17:05:07 +02:00
David
6a95540bf5
fix: nicer error message on bench execute 2024-09-13 16:52:16 +02:00
David
0c6fffa348
fix!: execute command
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>"`
2024-09-13 16:52:15 +02:00
David
d87b786687
chore: fix all invocation of init for singledispatch -> min 1 positional arg 2024-09-13 11:53:52 +02:00
David
e0fe0b8c88
chore: simplify config calling 2024-09-11 23:24:26 +02:00
David Arnold
a837fa28fb
Merge pull request #25734 from blaggacao/feat/debug-tests
feat: add debug tests
2024-09-04 20:11:58 +02:00
David (aider)
85c9a6b1c8
feat: add list-sites command 2024-09-04 19:51:05 +02:00
David (aider)
f194eeee92
feat: add --pdb 2024-09-04 19:49:52 +02:00
David
39d4318a27
feat: enable db socket connection 2024-03-29 10:29:50 +01:00
Akhil Narang
3a7dd3a1db
Merge pull request #25417 from akhilnarang/psql-history-log
fix: log psql console usage as well
2024-03-14 12:33:24 +05:30
Akhil Narang
d0923b0cd9
refactor: move histfile setting into helper function
This will ensure even users of `bench db-console` can use it

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-03-14 11:12:17 +05:30
Akhil Narang
afdb455b5a
fix: log psql console usage as well
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-03-14 10:56:17 +05:30
Akhil Narang
8e057e2010
fix(console): use frappe.conf.db_user
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-03-14 09:06:19 +05:30
Ankush Menat
532e1ef402
Merge pull request #25366 from ankush/mariadb_logging
fix: log mariadb console usage
2024-03-12 20:45:54 +05:30
Ankush Menat
676c40a15b
Merge pull request #25364 from ankush/ipython_logging
fix: Log ipython commands
2024-03-12 20:34:15 +05:30
Ankush Menat
2d75dbb598 fix: log mariadb console usage 2024-03-12 20:33:27 +05:30
Ankush Menat
8bdc88f06d fix: Log ipython commands 2024-03-12 20:11:00 +05:30
Ankush Menat
59f421cd04
fix: traceback colours (#25356)
default ipython colours use yellow on white font, which looks horrible
and is practically unreadable on most colourschemes.
2024-03-12 10:22:18 +00:00
Akhil Narang
3f1e19de85
refactor(treewide): enable RUF rules
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-21 16:20:28 +05:30
Akhil Narang
26ae0f3460
fix: ruff fixes
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-07 17:04:31 +05:30
Ankush Menat
33d0db364b
feat: allow configuring coverage from envvar (#24788) 2024-02-06 10:06:48 +00:00
Ankush Menat
de9ac89748 style: re-format with ruff 2024-02-05 18:53:33 +05:30
Akhil Narang
60c1812cc2
fix(run-tests): don't try to access frappe.flags before frappe.init()
Broke in #24432

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-02 22:26:01 +05:30
David Arnold
c57bc94ead
chore: cleanup frappe.connect invocations 2024-01-24 11:56:24 +01:00
Alan
7a68ebe3a4
Merge pull request #24412 from frappe/add-using-cached-build-flag
feat(Bench): add using-cached flag
2024-01-18 18:12:02 +05:30
mergify[bot]
483fcf89c3
Merge pull request #24428 from blaggacao/chore/cleanup-frappe-connect
chore: cleanup frappe connect (I/II)
2024-01-18 12:15:42 +00:00
18alantom
2da12b27cd refactor: set using cached with envvar 2024-01-18 16:25:14 +05:30
18alantom
9a87ec11e7 fix: add command to indicate use-cached support 2024-01-18 13:15:58 +05:30
Ankush Menat
ee6743c26b
fix: avoid mutating list while iterating over it (#24438) 2024-01-18 05:44:30 +00:00
David Arnold
d87092936f
chore: simplify frappe.connect & require explicit site initialization 2024-01-17 16:53:30 +01:00
18alantom
9ece71bc56 feat: add using-cached flag to bench build
- add using-cache flag to node esbuild call

The flag is to be used by bench get-app if its is
using cache.

Flag causes building of assets to not run and
instead updates assets.json files from built assets.

Linking of assets in the sites folder also occurs.
2024-01-17 13:20:57 +05:30
Ankush Menat
9482126b93 perf: Skip rebuilding MO files where PO file is not updated 2024-01-10 17:04:34 +05:30
Ankush Menat
5d8208ccf4 feat: Build MO files with bench build
Translation assets are also... assets, so grouping them with `bench build`.

We can do some special function but that will likely require updating
bench for everyone. Not so ideal.

Also renamed `compile` function as it is a builtin in python.
2024-01-10 16:41:04 +05:30
Ankush Menat
704043a2f8 chore: remove duplicate cache clearing
frappe.clear_cache removes everything
2023-12-28 19:00:03 +05:30
barredterra
483fa15c8f fix: clear translation cache
- Cache was not getting cleared, since it's user-specific
- Remove unused implementation from gettext
2023-12-26 23:17:31 +01:00
David Arnold
40a2daf84c
chore: give cli invocations of dbtools a dedicated interface 2023-11-09 12:14:41 +01:00
gavin
bedef22f34
fix(cli): Use mysql CLI as fallback is mariadb isnt found (#23004) 2023-10-30 19:48:04 +05:30
Akhil Narang
091ebdd8dc
refactor(treewide): use mariadb commands directly instead of mysql (#22620)
This has been done because the mysql command issues a deprecation warning now

mysql: Deprecated program name. It will be removed in a future release, use '/usr/bin/mariadb' instead

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-10-10 12:49:16 +05:30
barredterra
ed2290d1d6 Merge branch 'develop' into feat/improve-openid-connect-devx 2023-10-07 15:22:59 +02:00
Suraj Shetty
80347c9f28
Merge branch 'develop' into update-cy-new 2023-09-25 14:53:23 +05:30
Gavin D'souza
b19c569761
fix(run-ui-tests): Set default browser as chrome
Co-authored-by: Suraj Shetty <surajshetty3416@gmail.com>
2023-09-25 11:11:13 +05:30
Gavin D'souza
a5f709b468
ci: Use electron browser over chrome
* Electron is already shipped along with Cypress. Can we use it?
* Pass --record kwarg only if CYPRESS_RECORD_KEY envvar is set
2023-09-23 18:12:48 +05:30
Suraj Shetty
a496f6b5e1 build: Update cypress 2023-09-22 11:19:41 +05:30