From d8dc7361f2c66a24c4f249fcea6ee597934104ff Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 20 Jan 2026 13:19:55 +0000 Subject: [PATCH 1/3] Initial plan From 71b5b593661327a9c49a64b25b3892429cfd6fa2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 20 Jan 2026 13:23:31 +0000 Subject: [PATCH 2/3] fix: Apply black formatter to fix linting issues Co-authored-by: cbartz <4182921+cbartz@users.noreply.github.com> --- src/charm.py | 7 +++---- src/pipx.py | 1 - tests/conftest.py | 1 - tests/integration/conftest.py | 1 + tests/integration/test_charm.py | 1 + tests/unit/test_builder.py | 10 ++-------- tests/unit/test_charm.py | 1 + 7 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/charm.py b/src/charm.py index 51c22d9d..035f6e93 100755 --- a/src/charm.py +++ b/src/charm.py @@ -4,6 +4,7 @@ # See LICENSE file for licensing details. """Entrypoint for GithubRunnerImageBuilder charm.""" + import json import logging @@ -193,8 +194,7 @@ def _setup_builder(self) -> None: def _setup_logrotate(self) -> None: """Set up the log rotation for image-builder application.""" APP_LOGROTATE_CONFIG_PATH.write_text( - dedent( - f"""\ + dedent(f"""\ {str(LOG_FILE_PATH.absolute())} {{ weekly rotate 3 @@ -202,8 +202,7 @@ def _setup_logrotate(self) -> None: delaycompress missingok }} - """ - ), + """), encoding="utf-8", ) try: diff --git a/src/pipx.py b/src/pipx.py index abc9f49e..9eef91d4 100644 --- a/src/pipx.py +++ b/src/pipx.py @@ -4,7 +4,6 @@ """Module handling interactions with pipx.""" - # Code is abstracting process interactions and is currently tested in integration tests. import logging diff --git a/tests/conftest.py b/tests/conftest.py index 3e7eccbc..96f5e0d2 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -3,7 +3,6 @@ """Fixtures for github runner charm.""" - from pytest import Parser diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 2159c58d..96bc13c9 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -2,6 +2,7 @@ # See LICENSE file for licensing details. """Fixtures for github runner charm integration tests.""" + import functools import json import logging diff --git a/tests/integration/test_charm.py b/tests/integration/test_charm.py index 55c42067..7a7236a9 100644 --- a/tests/integration/test_charm.py +++ b/tests/integration/test_charm.py @@ -4,6 +4,7 @@ # See LICENSE file for licensing details. """Integration testing module.""" + import json import logging from contextlib import asynccontextmanager diff --git a/tests/unit/test_builder.py b/tests/unit/test_builder.py index aa11513f..a6f7f586 100644 --- a/tests/unit/test_builder.py +++ b/tests/unit/test_builder.py @@ -255,9 +255,7 @@ def test_install_clouds_yaml_not_exists(monkeypatch: pytest.MonkeyPatch, tmp_pat ) contents = test_path.read_text(encoding="utf-8") - assert ( - contents - == f"""clouds: + assert contents == f"""clouds: test: auth: auth_url: test-url @@ -267,7 +265,6 @@ def test_install_clouds_yaml_not_exists(monkeypatch: pytest.MonkeyPatch, tmp_pat user_domain_name: test_domain username: test-user """ - ) def test_install_clouds_yaml_unchanged(monkeypatch: pytest.MonkeyPatch, tmp_path: Path): @@ -300,9 +297,7 @@ def test_install_clouds_yaml_unchanged(monkeypatch: pytest.MonkeyPatch, tmp_path builder.install_clouds_yaml(cloud_config=test_config) contents = test_path.read_text(encoding="utf-8") - assert ( - contents - == f"""clouds: + assert contents == f"""clouds: test: auth: auth_url: test-url @@ -312,7 +307,6 @@ def test_install_clouds_yaml_unchanged(monkeypatch: pytest.MonkeyPatch, tmp_path user_domain_name: test_domain username: test-user """ - ) @pytest.mark.parametrize( diff --git a/tests/unit/test_charm.py b/tests/unit/test_charm.py index eb4eb18d..a0a06104 100644 --- a/tests/unit/test_charm.py +++ b/tests/unit/test_charm.py @@ -2,6 +2,7 @@ # See LICENSE file for licensing details. """Unit tests for charm module.""" + import secrets # We're monkeypatching the subprocess module for testing From 8694001f094b25de6e0f864506e7c52aed5ed49a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 20 Jan 2026 13:35:05 +0000 Subject: [PATCH 3/3] fix: Apply black formatter to app directory test files Co-authored-by: cbartz <4182921+cbartz@users.noreply.github.com> --- app/tests/conftest.py | 1 - app/tests/integration/conftest.py | 1 + app/tests/integration/helpers.py | 6 ++---- app/tests/unit/test_logging.py | 1 + 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/tests/conftest.py b/app/tests/conftest.py index 884af93f..35cb4663 100644 --- a/app/tests/conftest.py +++ b/app/tests/conftest.py @@ -3,7 +3,6 @@ """Fixtures for github runner image builder app.""" - from pytest import Parser diff --git a/app/tests/integration/conftest.py b/app/tests/integration/conftest.py index 1c3fa53f..36ffebcc 100644 --- a/app/tests/integration/conftest.py +++ b/app/tests/integration/conftest.py @@ -2,6 +2,7 @@ # See LICENSE file for licensing details. """Fixtures for github runner image builder integration tests.""" + import logging import os import secrets diff --git a/app/tests/integration/helpers.py b/app/tests/integration/helpers.py index fb12dffc..38f11a49 100644 --- a/app/tests/integration/helpers.py +++ b/app/tests/integration/helpers.py @@ -382,8 +382,7 @@ def setup_aproxy(ssh_connection: SSHConnection, proxy: str) -> None: proxy: The hostname and port in the format of "hostname:port". """ ssh_connection.run(f"/usr/bin/sudo snap set aproxy proxy={proxy} listen=:8444") - ssh_connection.run( - """/usr/bin/sudo nft -f - << EOF + ssh_connection.run("""/usr/bin/sudo nft -f - << EOF define default-ip = $(ip route get $(ip route show 0.0.0.0/0 | grep -oP 'via \\K\\S+') \ | grep -oP 'src \\K\\S+') define private-ips = { 10.0.0.0/8, 127.0.0.1/8, 172.16.0.0/12, 192.168.0.0/16 } @@ -400,8 +399,7 @@ def setup_aproxy(ssh_connection: SSHConnection, proxy: str) -> None: } } EOF -""" - ) +""") # Wait for aproxy to become active. for _ in range(6): time.sleep(5) diff --git a/app/tests/unit/test_logging.py b/app/tests/unit/test_logging.py index d6ab7efc..326904fa 100644 --- a/app/tests/unit/test_logging.py +++ b/app/tests/unit/test_logging.py @@ -2,6 +2,7 @@ # See LICENSE file for licensing details. """Unit tests for logging module.""" + import logging as logging_module from pathlib import Path from unittest.mock import MagicMock