Commit graph

47631 commits

Author SHA1 Message Date
David Arnold
e7776021aa
refactor: Structure frappe.test.utils (green to green) (#28038)
* docs: constitute frappe.test readme

* refactor: move utils to __init__

* refactor: move generators into generators.py

* refactor: move cm into context_managers.py

* refactor: move test classes into submodule

* refactor: reexport general purpose context managers

* refactor: adapt imports (treewide)
2024-10-08 15:10:24 +00:00
David Arnold
b0b8139233
fix: commit watcher logger (#28037) 2024-10-08 12:17:42 +00:00
Sumit Bhanushali
dbebd81ef5
Merge pull request #28034 from frappe/attachment-style
fix: alignment and icon color for attachments
2024-10-08 17:30:10 +05:30
Akhil Narang
88bb7601d4
Merge pull request #28033 from akhilnarang/update-role-migration-patch
fix: ensure that the role exists
2024-10-08 17:17:27 +05:30
Sumit Bhanushali
65600558b9 fix: removed line height as it caused truncate for some letters 2024-10-08 17:17:19 +05:30
Sumit Bhanushali
98ce759cab fix: alignment and icon color for attachments 2024-10-08 16:53:21 +05:30
Akhil Narang
84bee76aba
fix: ensure that the role exists
Some setups can have broken links here, resulting in a KeyError

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-10-08 16:52:57 +05:30
David Arnold
5324431fc0
fix: Testing Module 28000 (#28032)
* fix: logging text

* fix: app handling
2024-10-08 10:14:19 +00:00
Sumit Bhanushali
a7507c66f2
Merge pull request #27942 from zaqoutabed/develop
feat: allow user to set attachment field public by default
2024-10-08 13:23:29 +05:30
Sumit Bhanushali
750a373388
fix: update docfield public attachment field label to convey that default behaviour
Co-authored-by: David Arnold <dgx.arnold@gmail.com>
2024-10-08 13:09:11 +05:30
Akhil Narang
d453db40ba
Merge pull request #27909 from akhilnarang/number-format-currency-option
chore: add in system setting to allow using number format from currency
2024-10-08 13:03:08 +05:30
Akhil Narang
e25c012491
Merge pull request #28020 from akhilnarang/fix-grid-crash-webform
fix(grid): return if no df
2024-10-08 12:03:09 +05:30
Sumit Bhanushali
2b1150ff44
Merge pull request #27736 from JefteSG/develop
feat: implement Clear Button in Link Field
2024-10-08 12:02:29 +05:30
Sumit Bhanushali
b4eb8fdc82
fix: trailing whitespace 2024-10-08 11:48:44 +05:30
Akhil Narang
3fdd9624d8
fix(grid): return if no df
Certain cases seem to cause this for web forms

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-10-08 10:56:54 +05:30
David Arnold
bd62f20a43
docs: add README for Frappe test utilities (#28016) 2024-10-07 17:54:12 +00:00
Sumit Bhanushali
c5432b950f
Merge pull request #28013 from frappe/undef-fix
fix: check for undefined when setting current app
2024-10-07 20:04:26 +05:30
Sumit Bhanushali
ba0f25e1a5 fix: check for undefined when setting current app 2024-10-07 19:48:47 +05:30
Sumit Bhanushali
8983b13a3f
Merge pull request #28010 from frappe/revert-27881-login_ws_fix
Revert "fix: reroute to /app when loggedin user does not have access to defau…"
2024-10-07 17:29:58 +05:30
Akhil Narang
2adaf795f0
Merge pull request #28008 from frappe/dependabot/npm_and_yarn/cookie-0.7.0
chore(deps): bump cookie from 0.4.2 to 0.7.0
2024-10-07 17:21:15 +05:30
Sumit Bhanushali
4f6a63a0d9
Revert "fix: reroute to /app when loggedin user does not have access to defau…" 2024-10-07 17:16:44 +05:30
Jefte Sales Gonçalves
f54d2d985e fix: Error correction 2024-10-07 11:26:33 +00:00
dependabot[bot]
af5821a7b7
chore(deps): bump cookie from 0.4.2 to 0.7.0
Bumps [cookie](https://github.com/jshttp/cookie) from 0.4.2 to 0.7.0.
- [Release notes](https://github.com/jshttp/cookie/releases)
- [Commits](https://github.com/jshttp/cookie/compare/v0.4.2...v0.7.0)

---
updated-dependencies:
- dependency-name: cookie
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-07 10:54:33 +00:00
Akhil Narang
3dfb53adac
Merge pull request #27981 from frappe/dependabot/npm_and_yarn/sentry/browser-7.119.1
chore(deps): bump @sentry/browser from 7.81.1 to 7.119.1
2024-10-07 16:24:03 +05:30
Akhil Narang
0c38773582
Merge pull request #28007 from akhilnarang/fix-27931
fix: set `print_logs=False` for some `has_permission()` calls
2024-10-07 16:14:28 +05:30
David Arnold
3fafe99f6d
fix: temporary escape hath for erpnext tests (#28006) 2024-10-07 12:35:12 +02:00
Akhil Narang
9b5af4a603
fix: set print_logs=False for some has_permission() calls
This otherwise results in a lot of spam like: https://github.com/frappe/frappe/pull/27931#issuecomment-2396505626

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-10-07 16:00:39 +05:30
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
Akhil Narang
349dd8ed12
Merge pull request #27993 from rohitwaghchaure/fixed-support-23068
feat: provision to make setters read only in multidialog
2024-10-07 10:39:53 +05:30
avc
da28df59e9
fix: try catch for license text fetching (#27526) 2024-10-06 23:26:23 +02:00
hyaray
30ecfb3843
Update query_report.js (#27830) 2024-10-06 22:54:35 +02:00
DHia' SHalabi
8d83b966a0
refactor: optimize custom button logic for navigation (#27997) 2024-10-06 22:43:59 +02:00
David Arnold
5d3697500e
refactor: improve maintainability with a simple dispatcher (#27975)
* refactor: improve maintainability with a simple dispatcher

* refactor: improve maintainability with a init dispatcher on Document

* refactor: improve maintainability with an init dispatcher on meta
2024-10-06 16:56:40 +00: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
c114e5fae8
refactor: unit vs integration treewide (#27992)
* 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
2024-10-06 09:43:36 +00:00
Rohit Waghchaure
3436dc0fff feat: provision to make setters read only in multidialog 2024-10-06 10:12:30 +05:30
Priyansh Agrawal
cfb04b93e1
refactor: Replace hard-coded pg default port with PostgresDatabase.default_port (#27989) 2024-10-05 17:59:26 +00:00
Priyansh Agrawal
7d4b970a3b
chore: fix typo in PULL_REQUEST_TEMPLATE.md (#27990) 2024-10-05 17:58:38 +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 Arnold
a26afa14a7
refactor: Improve Test runner 2c (#27986)
* refactor: use pathlib for file operations

* feat: Add caching to get_dependencies and get_modules functions
2024-10-04 21:56:46 +02:00
David Arnold
6740fb3de1
refactor: Test Runner improvements 2b (#27985)
* refactor: simplify print_mandatory_fields function

* refactor: Encapsulate test record log functionality into a class

* refactor: Simplify and consolidate make_test_records_for_doctype function
2024-10-04 18:56:41 +00:00
David Arnold
1e2a74bcd9
refactor: Improve Test Runner 2a (#27984)
* refactor: Improve readability and maintainability of main function

* refactor: Simplify and optimize the run_all_tests function

* refactor: simplify run_tests_for_doctype function

* refactor: hint private methods

* refactor: simplify _run_unittest function

* refactor: simplify _add_test function

* fix: Rename `iterate_suite` to `_iterate_suite`
2024-10-04 20:27:46 +02:00
David Arnold
3e565ceab2
Merge pull request #27980 from blaggacao/test/runner-imp-1
Test Runner improvements 1
2024-10-04 20:05:40 +02:00
David (aider)
b168e38398
feat: Improve test runner with better error handling, configuration, and extensibility 2024-10-04 19:51:27 +02:00
David (aider)
c7b155d9a4
fix: Replace typing.List with list and use f-strings for formatting 2024-10-04 19:40:50 +02:00
David (aider)
94fc7135b4
feat: Add type hints, use f-strings, implement context managers, and optimize imports in test_runner.py 2024-10-04 19:40:49 +02:00
dependabot[bot]
226d7e09d0
chore(deps): bump @sentry/browser from 7.81.1 to 7.119.1
Bumps [@sentry/browser](https://github.com/getsentry/sentry-javascript) from 7.81.1 to 7.119.1.
- [Release notes](https://github.com/getsentry/sentry-javascript/releases)
- [Changelog](https://github.com/getsentry/sentry-javascript/blob/7.119.1/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-javascript/compare/7.81.1...7.119.1)

---
updated-dependencies:
- dependency-name: "@sentry/browser"
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-04 17:22:04 +00:00
David Arnold
010dab4db7
Merge pull request #27957 from blaggacao/ci/add-trick
ci: use dynamic total job
2024-10-04 15:36:28 +02:00
David
b77f112fb2
ci: measure bench install times and control verbosity 2024-10-04 15:22:53 +02:00