From 93bef62fce4ca97083429825f8368102fba3fb87 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 17 Jan 2025 14:42:27 +0100 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#63) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v5.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.5.0...v5.0.0) - [github.com/psf/black: 23.12.1 → 24.10.0](https://github.com/psf/black/compare/23.12.1...24.10.0) - [github.com/astral-sh/ruff-pre-commit: v0.1.14 → v0.9.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.14...v0.9.1) - [github.com/asottile/pyupgrade: v3.15.0 → v3.19.1](https://github.com/asottile/pyupgrade/compare/v3.15.0...v3.19.1) - [github.com/adamchainz/django-upgrade: 1.15.0 → 1.22.2](https://github.com/adamchainz/django-upgrade/compare/1.15.0...1.22.2) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Leonardo Cavallucci --- .pre-commit-config.yaml | 10 +++++----- tests/sample/test_project/urls.py | 1 + tests/test_cli.py | 16 ++++++++++------ tests/test_enable.py | 8 +++++--- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8fac554..eebb184 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ exclude: "(.idea|node_modules|.tox)" repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v5.0.0 hooks: - id: trailing-whitespace exclude: "setup.cfg" @@ -22,21 +22,21 @@ repos: hooks: - id: isort - repo: https://github.com/psf/black - rev: 23.12.1 + rev: 24.10.0 hooks: - id: black - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 'v0.1.14' + rev: 'v0.9.1' hooks: - id: ruff - repo: https://github.com/asottile/pyupgrade - rev: v3.15.0 + rev: v3.19.1 hooks: - id: pyupgrade args: - --py3-plus - repo: https://github.com/adamchainz/django-upgrade - rev: "1.15.0" + rev: "1.22.2" hooks: - id: django-upgrade args: [--target-version, "3.2"] diff --git a/tests/sample/test_project/urls.py b/tests/sample/test_project/urls.py index 7f56d83..0527ba1 100644 --- a/tests/sample/test_project/urls.py +++ b/tests/sample/test_project/urls.py @@ -13,6 +13,7 @@ 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ + from django.conf.urls.i18n import i18n_patterns from django.contrib import admin from django.contrib.sitemaps.views import sitemap diff --git a/tests/test_cli.py b/tests/test_cli.py index cc037a8..2f645f4 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -35,9 +35,11 @@ def test_cli_sys_path(project_dir, blog_package): def test_cli_install(project_dir, blog_package): """Running install command calls the business functions with the correct arguments.""" - with patch("app_enabler.cli.enable_fun") as enable_fun, patch( - "app_enabler.cli.install_fun" - ) as install_fun, working_directory(project_dir): + with ( + patch("app_enabler.cli.enable_fun") as enable_fun, + patch("app_enabler.cli.install_fun") as install_fun, + working_directory(project_dir), + ): runner = CliRunner() result = runner.invoke(cli, ["--verbose", "install", "djangocms-blog"]) assert result.exit_code == 0 @@ -80,9 +82,11 @@ def test_cli_install_error_verbose(verbose: bool): @pytest.mark.parametrize("verbose", (True, False)) def test_cli_install_bad_application_verbose(verbose: bool): """Error due to bad application name is reported to the user.""" - with patch("app_enabler.cli.enable_fun") as enable_fun, patch("app_enabler.cli.install_fun"), patch( - "app_enabler.cli.get_application_from_package" - ) as get_application_from_package: + with ( + patch("app_enabler.cli.enable_fun") as enable_fun, + patch("app_enabler.cli.install_fun"), + patch("app_enabler.cli.get_application_from_package") as get_application_from_package, + ): get_application_from_package.return_value = None runner = CliRunner() diff --git a/tests/test_enable.py b/tests/test_enable.py index 992343d..0e9908c 100644 --- a/tests/test_enable.py +++ b/tests/test_enable.py @@ -58,9 +58,11 @@ def test_enable_minimal(capsys, pytester, project_dir, addon_config_minimal, tea def test_verify_fail(capsys, pytester, project_dir, addon_config_minimal, blog_package, teardown_django): """Enabling application load the addon configuration in settings and urlconf - minimal addon config.""" - with working_directory(project_dir), patch("app_enabler.enable.load_addon") as load_addon, patch( - "app_enabler.enable.verify_installation" - ) as verify_installation: + with ( + working_directory(project_dir), + patch("app_enabler.enable.load_addon") as load_addon, + patch("app_enabler.enable.verify_installation") as verify_installation, + ): load_addon.return_value = addon_config_minimal verify_installation.return_value = False os.environ["DJANGO_SETTINGS_MODULE"] = "test_project.settings"