Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 25, 2024
1 parent 1057e79 commit c46b5d5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions tests/sample/test_project/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 10 additions & 6 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
8 changes: 5 additions & 3 deletions tests/test_enable.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit c46b5d5

Please sign in to comment.