diff --git a/.github/workflows/_base-server-tests.yml b/.github/workflows/_base-server-tests.yml index ed784641dccd..90fa8445827b 100644 --- a/.github/workflows/_base-server-tests.yml +++ b/.github/workflows/_base-server-tests.yml @@ -29,7 +29,7 @@ on: enable-coverage: required: false type: boolean - default: false + default: true jobs: @@ -100,7 +100,6 @@ jobs: python-version: ${{ inputs.python-version }} node-version: ${{ inputs.node-version }} disable-socketio: true - enable-coverage: ${{ inputs.enable-coverage }} db-root-password: ${{ env.DB_ROOT_PASSWORD }} db: ${{ matrix.db }} env: @@ -110,29 +109,11 @@ jobs: run: | bench --site test_site \ run-parallel-tests \ + --with-coverage \ --app "${{ github.event.repository.name }}" \ --total-builds ${{ inputs.parallel-runs }} \ - --build-number ${{ matrix.index }} 2> >(tee -a stderr.log >&2) - - # Process warnings and create annotations - if [ -s stderr.log ] && [ "$DB" == "mariadb" ]; then - echo "Processing deprecation warnings..." - grep -E "DeprecationWarning" stderr.log | sort -u | while read -r warning; do - # Extract file path, line number, and warning type - file_info=$(echo "$warning" | grep -oP '^.*?:\d+:') - file_path=$(echo "$file_info" | cut -d':' -f1) - line_number=$(echo "$file_info" | cut -d':' -f2) - warning_type=$(echo "$warning" | grep -oP '\w+Warning') - - # Extract the actual warning message - message=$(echo "$warning" | sed -E "s/^.*$warning_type: //") + --build-number ${{ matrix.index }} - # Create the annotation - echo "::warning file=${file_path},line=${line_number}::${warning_type}: ${message}" - done - else - echo "No deprecation warnings found." - fi env: DB: ${{ matrix.db }} # consumed by bench run-parallel-tests @@ -144,7 +125,7 @@ jobs: if: inputs.enable-coverage with: name: coverage-${{ matrix.db }}-${{ matrix.index }} - path: ./sites/*-coverage*.xml + path: ./sites/*coverage*.xml - name: Setup tmate session uses: mxschmitt/action-tmate@v3 diff --git a/.github/workflows/server-tests.yml b/.github/workflows/server-tests.yml index b35427d7f721..a843908e8443 100644 --- a/.github/workflows/server-tests.yml +++ b/.github/workflows/server-tests.yml @@ -48,7 +48,6 @@ jobs: enable-postgres: ${{ needs.checkrun.outputs.run_postgres == 'true' }} # This enables PostgreSQL to run tests enable-sqlite: false # This will test against both MariaDB and SQLite if enabled parallel-runs: 2 - enable-coverage: ${{ github.event_name != 'pull_request' }} fake-success: ${{ needs.checkrun.outputs.build != 'strawberry' }} needs: checkrun secrets: inherit @@ -67,7 +66,6 @@ jobs: name: Coverage Wrap Up needs: [test, checkrun] runs-on: ubuntu-latest - if: ${{ github.event_name != 'pull_request' }} steps: - name: Clone uses: actions/checkout@v6 diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml index c533f36b7ec2..f11257702165 100644 --- a/.github/workflows/ui-tests.yml +++ b/.github/workflows/ui-tests.yml @@ -44,14 +44,14 @@ jobs: uses: ./.github/workflows/_base-ui-tests.yml with: parallel-runs: 3 - enable-coverage: ${{ github.event_name != 'pull_request' }} + enable-coverage: false fake-success: ${{ needs.checkrun.outputs.build != 'strawberry' }} needs: checkrun coverage: name: Coverage Wrap Up needs: [test, checkrun] - if: ${{ github.event_name != 'pull_request' }} + if: ${{ needs.checkrun.outputs.build == 'strawberry' }} runs-on: ubuntu-latest steps: - name: Clone diff --git a/codecov.yml b/codecov.yml index 3fca9d93849e..b880e25e69e4 100644 --- a/codecov.yml +++ b/codecov.yml @@ -29,10 +29,6 @@ flags: paths: - "**/*.py" carryforward: true - ui-tests: - paths: - - "**/*.js" - carryforward: true server-ui: paths: - "**/*.py" diff --git a/frappe/commands/testing.py b/frappe/commands/testing.py index 394b4c29cf5a..6869b5a9744f 100644 --- a/frappe/commands/testing.py +++ b/frappe/commands/testing.py @@ -144,7 +144,6 @@ def main( verbosity=2 if testing_module_logger.getEffectiveLevel() < logging.INFO else 1, tb_locals=testing_module_logger.getEffectiveLevel() <= logging.INFO, cfg=test_config, - buffer=not debug, # unfortunate as it messes up stdout/stderr output order ) if doctype or doctype_list_path: diff --git a/frappe/core/doctype/user/user.py b/frappe/core/doctype/user/user.py index f31b400e3242..d62c68dc820e 100644 --- a/frappe/core/doctype/user/user.py +++ b/frappe/core/doctype/user/user.py @@ -4,7 +4,7 @@ import re from collections.abc import Iterable from datetime import timedelta -from functools import cached_property +from functools import cached_property, lru_cache from typing import Any import frappe @@ -894,9 +894,14 @@ def validate_ip_addr(self): @frappe.whitelist() def get_timezones(): - import zoneinfo + return {"timezones": _get_timezones()} - return {"timezones": zoneinfo.available_timezones()} + +@lru_cache(maxsize=1) +def _get_timezones(): + import pytz + + return sorted(pytz.common_timezones) @frappe.whitelist() @@ -1038,6 +1043,9 @@ def has_email_account(email: str): @frappe.whitelist(allow_guest=False) def get_email_awaiting(user: str): + if user != frappe.session.user: + frappe.has_permission("User", "read", doc=user, throw=True) + return frappe.get_all( "User Email", fields=["email_account", "email_id"], diff --git a/frappe/coverage.py b/frappe/coverage.py index 8b6fa7007db9..7d87b36fc764 100644 --- a/frappe/coverage.py +++ b/frappe/coverage.py @@ -22,6 +22,7 @@ "*/node_modules/*", "*/doctype/*/*_dashboard.py", "*/patches/*", + "*/.github/*", ] # tested via commands' test suite @@ -78,7 +79,12 @@ def __enter__(self): if self.app == "frappe": omit.extend(FRAPPE_EXCLUSIONS) - self.coverage = Coverage(source=[source_path], omit=omit, include=STANDARD_INCLUSIONS) + self.coverage = Coverage( + source=[source_path], + omit=omit, + include=STANDARD_INCLUSIONS, + data_suffix=True, + ) self.coverage.start() return self diff --git a/frappe/parallel_test_runner.py b/frappe/parallel_test_runner.py index d879241e33dd..3b067b44594b 100644 --- a/frappe/parallel_test_runner.py +++ b/frappe/parallel_test_runner.py @@ -14,7 +14,6 @@ import frappe from frappe.tests.utils import make_test_records, toggle_test_mode -from .testing.environment import _decorate_all_methods_and_functions_with_type_checker from .testing.result import TestResult click_ctx = click.get_current_context(True) @@ -61,7 +60,6 @@ def setup_test_site(self): frappe.clear_cache() frappe.utils.scheduler.disable_scheduler() if not self.lightmode: - _decorate_all_methods_and_functions_with_type_checker() self.before_test_setup() def before_test_setup(self): diff --git a/frappe/patches.txt b/frappe/patches.txt index add082e78d0a..3537b5504486 100644 --- a/frappe/patches.txt +++ b/frappe/patches.txt @@ -260,4 +260,4 @@ execute:from frappe.email.doctype.notification.notification import install_notif execute:frappe.db.set_value("Email Account", {}, "add_x_original_from", 1) frappe.patches.v16_0.fix_myanmar_language_name execute:frappe.db.set_value("Email Account", {}, "add_reply_to_header", 1) -frappe.patches.v16_0.set_reply_to_header +frappe.patches.v16_0.set_reply_to_header \ No newline at end of file diff --git a/frappe/public/js/frappe/ui/page.html b/frappe/public/js/frappe/ui/page.html index 2ceb3586c5c2..acf74d94a16d 100644 --- a/frappe/public/js/frappe/ui/page.html +++ b/frappe/public/js/frappe/ui/page.html @@ -13,7 +13,7 @@ -