diff --git a/src/gardenlinux/features/cname.py b/src/gardenlinux/features/cname.py
index 66e4d37f..d8ce7d72 100644
--- a/src/gardenlinux/features/cname.py
+++ b/src/gardenlinux/features/cname.py
@@ -13,7 +13,6 @@
from ..constants import (
ARCHS,
GL_BUG_REPORT_URL,
- GL_COMMIT_SPECIAL_VALUES,
GL_DISTRIBUTION_NAME,
GL_HOME_URL,
GL_RELEASE_ID,
diff --git a/src/gardenlinux/features/metadata_main.py b/src/gardenlinux/features/metadata_main.py
index 84928ba6..9497e02b 100644
--- a/src/gardenlinux/features/metadata_main.py
+++ b/src/gardenlinux/features/metadata_main.py
@@ -6,19 +6,8 @@
"""
import argparse
-import logging
-import re
-from functools import reduce
-from os.path import basename, dirname
-
-from .__main__ import (
- get_cname_base,
- get_minimal_feature_set,
- get_version_and_commit_id_from_files,
- sort_subset,
-)
+
from .cname import CName
-from .parser import Parser
_ARGS_ACTION_ALLOWED = [
"output-release-metadata",
diff --git a/src/gardenlinux/flavors/__main__.py b/src/gardenlinux/flavors/__main__.py
index db3f50c3..dda219d9 100644
--- a/src/gardenlinux/flavors/__main__.py
+++ b/src/gardenlinux/flavors/__main__.py
@@ -6,8 +6,6 @@
"""
import json
-import os
-import sys
from argparse import ArgumentParser
from pathlib import Path
from tempfile import TemporaryDirectory
diff --git a/src/gardenlinux/github/__main__.py b/src/gardenlinux/github/__main__.py
index de2a6f63..d3b33a21 100644
--- a/src/gardenlinux/github/__main__.py
+++ b/src/gardenlinux/github/__main__.py
@@ -3,7 +3,11 @@
from gardenlinux.constants import GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME
from gardenlinux.logger import LoggerSetup
-from .release import create_github_release, upload_to_github_release_page, write_to_release_id_file
+from .release import (
+ create_github_release,
+ upload_to_github_release_page,
+ write_to_release_id_file,
+)
from .release_notes import create_github_release_notes
LOGGER = LoggerSetup.get_logger("gardenlinux.github", "INFO")
@@ -18,7 +22,7 @@ def main():
create_parser.add_argument("--repo", default="gardenlinux")
create_parser.add_argument("--tag", required=True)
create_parser.add_argument("--commit", required=True)
- create_parser.add_argument('--latest', action='store_true', default=False)
+ create_parser.add_argument("--latest", action="store_true", default=False)
create_parser.add_argument("--dry-run", action="store_true", default=False)
upload_parser = subparsers.add_parser("upload")
@@ -31,7 +35,9 @@ def main():
args = parser.parse_args()
if args.command == "create":
- body = create_github_release_notes(args.tag, args.commit, GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME)
+ body = create_github_release_notes(
+ args.tag, args.commit, GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME
+ )
if args.dry_run:
print("Dry Run ...")
print("This release would be created:")
diff --git a/src/gardenlinux/github/release/__init__.py b/src/gardenlinux/github/release/__init__.py
index f6af7379..18dd9cb8 100644
--- a/src/gardenlinux/github/release/__init__.py
+++ b/src/gardenlinux/github/release/__init__.py
@@ -27,14 +27,14 @@ def create_github_release(owner, repo, tag, commitish, latest, body):
"body": body,
"draft": False,
"prerelease": False,
- "make_latest": "true" if latest else "false"
+ "make_latest": "true" if latest else "false",
}
response = requests.post(
f"https://api.github.com/repos/{owner}/{repo}/releases",
headers=headers,
data=json.dumps(data),
- timeout=REQUESTS_TIMEOUTS
+ timeout=REQUESTS_TIMEOUTS,
)
if response.status_code == 201:
@@ -84,7 +84,9 @@ def upload_to_github_release_page(
LOGGER.error(f"Error reading file {file_to_upload}: {e}")
return
- response = requests.post(upload_url, headers=headers, data=file_contents, timeout=REQUESTS_TIMEOUTS)
+ response = requests.post(
+ upload_url, headers=headers, data=file_contents, timeout=REQUESTS_TIMEOUTS
+ )
if response.status_code == 201:
LOGGER.info("Upload successful")
else:
diff --git a/src/gardenlinux/github/release_notes/__init__.py b/src/gardenlinux/github/release_notes/__init__.py
index 2a9804f9..d1ab7e35 100644
--- a/src/gardenlinux/github/release_notes/__init__.py
+++ b/src/gardenlinux/github/release_notes/__init__.py
@@ -7,7 +7,9 @@
)
-def create_github_release_notes(gardenlinux_version, commitish, releases_s3_bucket_name):
+def create_github_release_notes(
+ gardenlinux_version, commitish, releases_s3_bucket_name
+):
package_list = get_package_list(gardenlinux_version)
output = ""
@@ -20,7 +22,9 @@ def create_github_release_notes(gardenlinux_version, commitish, releases_s3_buck
gardenlinux_version, package_list
)
- metadata_files = download_all_metadata_files(gardenlinux_version, commitish, releases_s3_bucket_name)
+ metadata_files = download_all_metadata_files(
+ gardenlinux_version, commitish, releases_s3_bucket_name
+ )
output += release_notes_image_ids_section(metadata_files)
diff --git a/src/gardenlinux/github/release_notes/deployment_platform/__init__.py b/src/gardenlinux/github/release_notes/deployment_platform/__init__.py
index 0c859ec9..9882dc53 100644
--- a/src/gardenlinux/github/release_notes/deployment_platform/__init__.py
+++ b/src/gardenlinux/github/release_notes/deployment_platform/__init__.py
@@ -1,7 +1,7 @@
from gardenlinux.constants import GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME
-class DeploymentPlatform():
+class DeploymentPlatform:
artifacts_bucket_name = GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME
def short_name(self):
@@ -25,7 +25,9 @@ def image_extension(self):
return "raw"
def artifact_for_flavor(self, flavor, markdown_format=True):
- base_url = f"https://{self.__class__.artifacts_bucket_name}.s3.amazonaws.com/objects"
+ base_url = (
+ f"https://{self.__class__.artifacts_bucket_name}.s3.amazonaws.com/objects"
+ )
filename = f"{flavor}.{self.image_extension()}"
download_url = f"{base_url}/{flavor}/{filename}"
if markdown_format:
@@ -48,7 +50,9 @@ def region_details(self, image_metadata):
"image_id": image_id,
"image_name": image_name,
}:
- details += f"**{region_name}:** {image_id} ({image_name})
"
+ details += (
+ f"**{region_name}:** {image_id} ({image_name})
"
+ )
case {"region": region_name, "image_id": image_id}:
details += f"**{region_name}:** {image_id}
"
case {"details": details_dict}:
@@ -93,7 +97,9 @@ def summary_text(self, image_metadata):
}:
gallery_count = len(gallery_images)
marketplace_count = len(marketplace_images)
- return f"{gallery_count} gallery + {marketplace_count} marketplace images"
+ return (
+ f"{gallery_count} gallery + {marketplace_count} marketplace images"
+ )
case {"gallery_images": gallery_images}:
gallery_count = len(gallery_images)
return f"{gallery_count} gallery images"
diff --git a/src/gardenlinux/github/release_notes/deployment_platform/ali_cloud.py b/src/gardenlinux/github/release_notes/deployment_platform/ali_cloud.py
index a9d38c08..cf40945f 100644
--- a/src/gardenlinux/github/release_notes/deployment_platform/ali_cloud.py
+++ b/src/gardenlinux/github/release_notes/deployment_platform/ali_cloud.py
@@ -1,3 +1,4 @@
+# pyright: reportIncompatibleMethodOverride=false
from . import DeploymentPlatform
diff --git a/src/gardenlinux/github/release_notes/deployment_platform/amazon_web_services.py b/src/gardenlinux/github/release_notes/deployment_platform/amazon_web_services.py
index 4353fe80..5013d08c 100644
--- a/src/gardenlinux/github/release_notes/deployment_platform/amazon_web_services.py
+++ b/src/gardenlinux/github/release_notes/deployment_platform/amazon_web_services.py
@@ -1,3 +1,4 @@
+# pyright: reportIncompatibleMethodOverride=false
from . import DeploymentPlatform
diff --git a/src/gardenlinux/github/release_notes/deployment_platform/azure.py b/src/gardenlinux/github/release_notes/deployment_platform/azure.py
index ee416658..58201a3e 100644
--- a/src/gardenlinux/github/release_notes/deployment_platform/azure.py
+++ b/src/gardenlinux/github/release_notes/deployment_platform/azure.py
@@ -1,3 +1,4 @@
+# pyright: reportIncompatibleMethodOverride=false
from . import DeploymentPlatform
diff --git a/src/gardenlinux/github/release_notes/deployment_platform/google_cloud.py b/src/gardenlinux/github/release_notes/deployment_platform/google_cloud.py
index f42457c7..bbad8563 100644
--- a/src/gardenlinux/github/release_notes/deployment_platform/google_cloud.py
+++ b/src/gardenlinux/github/release_notes/deployment_platform/google_cloud.py
@@ -1,3 +1,4 @@
+# pyright: reportIncompatibleMethodOverride=false
from . import DeploymentPlatform
diff --git a/src/gardenlinux/github/release_notes/deployment_platform/openstack.py b/src/gardenlinux/github/release_notes/deployment_platform/openstack.py
index 06cdd9c2..82a1c6ac 100644
--- a/src/gardenlinux/github/release_notes/deployment_platform/openstack.py
+++ b/src/gardenlinux/github/release_notes/deployment_platform/openstack.py
@@ -1,3 +1,4 @@
+# pyright: reportIncompatibleMethodOverride=false
from . import DeploymentPlatform
diff --git a/src/gardenlinux/github/release_notes/deployment_platform/openstack_baremetal.py b/src/gardenlinux/github/release_notes/deployment_platform/openstack_baremetal.py
index ddef8fd7..17d1c80b 100644
--- a/src/gardenlinux/github/release_notes/deployment_platform/openstack_baremetal.py
+++ b/src/gardenlinux/github/release_notes/deployment_platform/openstack_baremetal.py
@@ -1,3 +1,4 @@
+# pyright: reportIncompatibleMethodOverride=false
from .openstack import OpenStack
diff --git a/src/gardenlinux/github/release_notes/helpers.py b/src/gardenlinux/github/release_notes/helpers.py
index 45027e01..69103dac 100644
--- a/src/gardenlinux/github/release_notes/helpers.py
+++ b/src/gardenlinux/github/release_notes/helpers.py
@@ -61,11 +61,9 @@ def download_all_metadata_files(version, commitish, s3_bucket_name):
s3_artifacts = S3Artifacts(s3_bucket_name)
- commitish_short = commitish[:8]
-
for flavor in flavors:
- cname = CName(flavor[1], flavor[0], "{0}-{1}".format(version, commitish_short))
LOGGER.debug(f"{flavor=} {version=} {commitish=}")
+ cname = CName(flavor[1], flavor[0], commitish)
# Filter by image variants - only download if the flavor matches one of the variants
flavor_matches_variant = False
for variant_suffix in IMAGE_VARIANTS:
@@ -86,34 +84,34 @@ def download_all_metadata_files(version, commitish, s3_bucket_name):
continue
try:
+ commit_short = commitish[:8]
download_metadata_file(
- s3_artifacts, cname.cname, version, commitish_short, local_dest_path
+ s3_artifacts, cname, version, commit_short, local_dest_path
)
except IndexError:
- LOGGER.warn(f"No artifacts found for flavor {cname.cname}, skipping...")
+ LOGGER.warning(f"No artifacts found for flavor {cname.cname}, skipping...")
continue
return [str(artifact) for artifact in local_dest_path.iterdir()]
-def download_metadata_file(
- s3_artifacts, cname, version, commitish_short, artifacts_dir
-):
+def download_metadata_file(s3_artifacts, cname, version, commit_short, artifacts_dir):
"""
Download metadata file (s3_metadata.yaml)
"""
LOGGER.debug(
- f"{s3_artifacts=} | {cname=} | {version=} | {commitish_short=} | {artifacts_dir=}"
+ f"{s3_artifacts=} | {cname.cname=} | {version=} | {cname.commit_id=} | {commit_short=} | {artifacts_dir=}"
+ )
+ maybe_release_objects = s3_artifacts.bucket.objects.filter(
+ Prefix=f"meta/singles/{cname.cname}-{version}-{commit_short}"
)
- release_object = list(
- s3_artifacts._bucket.objects.filter(
- Prefix=f"meta/singles/{cname}-{version}-{commitish_short}"
- )
- )[0]
+
+ release_object = list(maybe_release_objects)[0]
LOGGER.debug(f"{release_object.bucket_name=} | {release_object.key=}")
s3_artifacts.bucket.download_file(
- release_object.key, artifacts_dir.joinpath(f"{cname}.s3_metadata.yaml")
+ release_object.key,
+ artifacts_dir.joinpath(f"{cname.cname}.s3_metadata.yaml"),
)
diff --git a/src/gardenlinux/oci/__main__.py b/src/gardenlinux/oci/__main__.py
index 5acb9a94..6f3a8fd8 100755
--- a/src/gardenlinux/oci/__main__.py
+++ b/src/gardenlinux/oci/__main__.py
@@ -4,10 +4,7 @@
gl-oci main entrypoint
"""
-import os
-
import click
-from pygments.lexer import default
from .container import Container
diff --git a/src/gardenlinux/oci/container.py b/src/gardenlinux/oci/container.py
index 9ed98f70..28b581a2 100644
--- a/src/gardenlinux/oci/container.py
+++ b/src/gardenlinux/oci/container.py
@@ -9,7 +9,6 @@
from base64 import b64encode
from collections.abc import Sequence
from configparser import UNNAMED_SECTION, ConfigParser
-from hashlib import sha256
from os import PathLike, fdopen, getenv
from pathlib import Path
from tempfile import mkstemp
@@ -18,12 +17,11 @@
import jsonschema
from oras.container import Container as OrasContainer
-from oras.defaults import unknown_config_media_type as UNKNOWN_CONFIG_MEDIA_TYPE
from oras.provider import Registry
from oras.utils import extract_targz, make_targz
from requests import Response
-from ..constants import GL_MEDIA_TYPE_LOOKUP, OCI_IMAGE_INDEX_MEDIA_TYPE
+from ..constants import OCI_IMAGE_INDEX_MEDIA_TYPE
from ..features.cname import CName
from ..logger import LoggerSetup
from .image_manifest import ImageManifest
@@ -117,7 +115,7 @@ def __init__(
# Login to registry if credentials are provided
if username and password:
- self._logger.debug(f"Logging in with username/password")
+ self._logger.debug("Logging in with username/password")
try:
self.login(username, password)
diff --git a/tests/conftest.py b/tests/conftest.py
index 238b1335..b99a3485 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,7 +1,6 @@
import json
import os
import shutil
-import subprocess
import sys
from datetime import datetime, timedelta
from tempfile import mkstemp
@@ -27,7 +26,7 @@
TEST_PLATFORMS,
TEST_VERSION,
)
-from .helper import call_command, spawn_background_process
+from .helper import spawn_background_process
def generate_test_certificates():
diff --git a/tests/constants.py b/tests/constants.py
index 47cc0399..3eec28d9 100644
--- a/tests/constants.py
+++ b/tests/constants.py
@@ -27,7 +27,9 @@
TEST_GARDENLINUX_COMMIT_SHORT = TEST_GARDENLINUX_COMMIT[:8]
TEST_GARDENLINUX_RELEASE_BUCKET_NAME = "test__gardenlinux__releases"
-RELEASE_NOTES_TEST_DATA_DIR = Path(os.path.dirname(__file__)) / ".." / "test-data" / "release_notes"
+RELEASE_NOTES_TEST_DATA_DIR = (
+ Path(os.path.dirname(__file__)) / ".." / "test-data" / "release_notes"
+)
RELEASE_NOTES_S3_ARTIFACTS_DIR = RELEASE_NOTES_TEST_DATA_DIR / "s3_bucket_artifacts"
RELEASE_ARTIFACTS_METADATA_FILES = [
@@ -83,5 +85,5 @@
"openstack-gardener_prod_usi-amd64.s3_metadata.yaml",
"openstack-gardener_prod_usi-arm64.s3_metadata.yaml",
"vmware-gardener_prod-amd64.s3_metadata.yaml",
- "vmware-gardener_prod-arm64.s3_metadata.yaml"
+ "vmware-gardener_prod-arm64.s3_metadata.yaml",
]
diff --git a/tests/features/test_cname.py b/tests/features/test_cname.py
index 4a12ef2c..de619a55 100644
--- a/tests/features/test_cname.py
+++ b/tests/features/test_cname.py
@@ -44,5 +44,7 @@ def test_cname_commit_id_setter():
cname = CName("container", arch="amd64", version="today", commit_hash="local")
# Act / Assert
- with pytest.raises(RuntimeError, match="Commit hash given differs from commit ID already set"):
+ with pytest.raises(
+ RuntimeError, match="Commit hash given differs from commit ID already set"
+ ):
cname.commit_hash = "broken"
diff --git a/tests/features/test_cname_main.py b/tests/features/test_cname_main.py
index f0aa2167..6c3151c7 100644
--- a/tests/features/test_cname_main.py
+++ b/tests/features/test_cname_main.py
@@ -5,7 +5,6 @@
import pytest
import gardenlinux.features.cname_main as cname_main
-from gardenlinux.features import CName
def test_main_happy(monkeypatch, capsys):
diff --git a/tests/features/test_metadata_main.py b/tests/features/test_metadata_main.py
index 26c0f568..0e1d0925 100644
--- a/tests/features/test_metadata_main.py
+++ b/tests/features/test_metadata_main.py
@@ -1,6 +1,4 @@
-import logging
import sys
-import types
from pathlib import Path
from tempfile import TemporaryDirectory
@@ -9,13 +7,11 @@
import gardenlinux.features.metadata_main as metadata_main
from gardenlinux.constants import (
GL_BUG_REPORT_URL,
- GL_COMMIT_SPECIAL_VALUES,
GL_DISTRIBUTION_NAME,
GL_HOME_URL,
GL_RELEASE_ID,
GL_SUPPORT_URL,
)
-from gardenlinux.features import CName
def get_container_amd64_release_metadata(version, commit_hash):
@@ -38,12 +34,22 @@ def get_container_amd64_release_metadata(version, commit_hash):
GARDENLINUX_COMMIT_ID_LONG="local"
""".strip()
+
def test_main_output(monkeypatch, capsys):
"""
Test successful "output-release-metadata"
"""
# Arrange
- argv = ["prog", "--cname", "container-amd64", "--version", "today", "--commit", "local", "output-release-metadata"]
+ argv = [
+ "prog",
+ "--cname",
+ "container-amd64",
+ "--version",
+ "today",
+ "--commit",
+ "local",
+ "output-release-metadata",
+ ]
monkeypatch.setattr(sys, "argv", argv)
# Act
@@ -53,6 +59,7 @@ def test_main_output(monkeypatch, capsys):
expected = get_container_amd64_release_metadata("today", "local")
assert expected == capsys.readouterr().out.strip()
+
def test_main_write(monkeypatch, capsys):
"""
Test successful "write"
@@ -60,7 +67,18 @@ def test_main_write(monkeypatch, capsys):
# Arrange
with TemporaryDirectory() as tmpdir:
os_release_file = Path(tmpdir, "os_release")
- argv = ["prog", "--cname", "container-amd64", "--version", "today", "--commit", "local", "--release-file", str(os_release_file), "write"]
+ argv = [
+ "prog",
+ "--cname",
+ "container-amd64",
+ "--version",
+ "today",
+ "--commit",
+ "local",
+ "--release-file",
+ str(os_release_file),
+ "write",
+ ]
monkeypatch.setattr(sys, "argv", argv)
# Act
@@ -70,6 +88,7 @@ def test_main_write(monkeypatch, capsys):
expected = get_container_amd64_release_metadata("today", "local")
assert expected == os_release_file.open("r").read()
+
def test_main_validation(monkeypatch):
"""
Test validation between release metadata and arguments given
@@ -81,7 +100,18 @@ def test_main_validation(monkeypatch):
with os_release_file.open("w") as fp:
fp.write(get_container_amd64_release_metadata("today", "local"))
- argv = ["prog", "--cname", "base-python-amd64", "--version", "today", "--commit", "local", "--release-file", str(os_release_file), "output-release-metadata"]
+ argv = [
+ "prog",
+ "--cname",
+ "base-python-amd64",
+ "--version",
+ "today",
+ "--commit",
+ "local",
+ "--release-file",
+ str(os_release_file),
+ "output-release-metadata",
+ ]
monkeypatch.setattr(sys, "argv", argv)
# Act / Assert
diff --git a/tests/flavors/test_init.py b/tests/flavors/test_init.py
index 05b5560b..8207df9b 100644
--- a/tests/flavors/test_init.py
+++ b/tests/flavors/test_init.py
@@ -1,5 +1,4 @@
import importlib
-import types
from gardenlinux import flavors
diff --git a/tests/flavors/test_main.py b/tests/flavors/test_main.py
index 407d746b..8c1ecc0c 100644
--- a/tests/flavors/test_main.py
+++ b/tests/flavors/test_main.py
@@ -1,10 +1,7 @@
import json
import sys
-import pytest
-
from gardenlinux.flavors import __main__ as fm
-from gardenlinux.git import Repository
def test_generate_markdown_table():
diff --git a/tests/flavors/test_parser.py b/tests/flavors/test_parser.py
index 854318bf..e4bfb1b5 100644
--- a/tests/flavors/test_parser.py
+++ b/tests/flavors/test_parser.py
@@ -1,5 +1,3 @@
-import types
-
import pytest
import yaml
diff --git a/tests/github/conftest.py b/tests/github/conftest.py
index 2f1dcffe..d15d4f3d 100644
--- a/tests/github/conftest.py
+++ b/tests/github/conftest.py
@@ -44,9 +44,13 @@ def release_id_file():
def release_s3_bucket():
with mock_aws():
s3 = boto3.resource("s3", region_name="eu-central-1")
- s3.create_bucket(Bucket=TEST_GARDENLINUX_RELEASE_BUCKET_NAME,
- CreateBucketConfiguration={"LocationConstraint": "eu-central-1"})
- yield s3.Bucket(TEST_GARDENLINUX_RELEASE_BUCKET_NAME)
+ s3.create_bucket( # pyright: ignore[reportAttributeAccessIssue]
+ Bucket=TEST_GARDENLINUX_RELEASE_BUCKET_NAME,
+ CreateBucketConfiguration={"LocationConstraint": "eu-central-1"},
+ )
+ yield s3.Bucket( # pyright: ignore[reportAttributeAccessIssue]
+ TEST_GARDENLINUX_RELEASE_BUCKET_NAME
+ )
@pytest.fixture
@@ -55,19 +59,20 @@ def blackhole_s3_bucket():
any object can be found, but downloading a file always raises an exception.
This is needed to test the retry mechanism as the object also counts
how many times an exception was raised."""
- class BlackHoleObject():
+
+ class BlackHoleObject:
def __init__(self, bucket_name, key):
self.bucket_name = bucket_name
self.key = key
- class BlackHoleObjects():
+ class BlackHoleObjects:
def __init__(self, bucket_name):
self.bucket_name = bucket_name
def filter(self, Prefix):
return [BlackHoleObject(self.bucket_name, Prefix)]
- class BlackHoleS3Bucket():
+ class BlackHoleS3Bucket:
def __init__(self, bucket_name):
self.objects = BlackHoleObjects(bucket_name)
self.download_attempts = 0
diff --git a/tests/github/test_create_github_release.py b/tests/github/test_create_github_release.py
index a2919a60..c876729c 100644
--- a/tests/github/test_create_github_release.py
+++ b/tests/github/test_create_github_release.py
@@ -19,9 +19,11 @@ def test_create_github_release_needs_github_token():
TEST_GARDENLINUX_RELEASE,
TEST_GARDENLINUX_COMMIT,
False,
- "")
- assert str(exn.value) == "GITHUB_TOKEN environment variable not set", \
- "Expected an exception to be raised on missing GITHUB_TOKEN environment variable"
+ "",
+ )
+ assert (
+ str(exn.value) == "GITHUB_TOKEN environment variable not set"
+ ), "Expected an exception to be raised on missing GITHUB_TOKEN environment variable"
def test_create_github_release_raise_on_failure(caplog, github_token):
@@ -30,7 +32,7 @@ def test_create_github_release_raise_on_failure(caplog, github_token):
m.post(
"https://api.github.com/repos/gardenlinux/gardenlinux/releases",
text="{}",
- status_code=503
+ status_code=503,
)
create_github_release(
"gardenlinux",
@@ -38,8 +40,11 @@ def test_create_github_release_raise_on_failure(caplog, github_token):
TEST_GARDENLINUX_RELEASE,
TEST_GARDENLINUX_COMMIT,
False,
- "")
- assert any("Failed to create release" in record.message for record in caplog.records), "Expected a failure log record"
+ "",
+ )
+ assert any(
+ "Failed to create release" in record.message for record in caplog.records
+ ), "Expected a failure log record"
def test_create_github_release(caplog, github_token):
@@ -47,16 +52,23 @@ def test_create_github_release(caplog, github_token):
m.post(
"https://api.github.com/repos/gardenlinux/gardenlinux/releases",
text='{"id": 101}',
- status_code=201
+ status_code=201,
+ )
+ assert (
+ create_github_release(
+ "gardenlinux",
+ "gardenlinux",
+ TEST_GARDENLINUX_RELEASE,
+ TEST_GARDENLINUX_COMMIT,
+ False,
+ "",
+ )
+ == 101
)
- assert create_github_release(
- "gardenlinux",
- "gardenlinux",
- TEST_GARDENLINUX_RELEASE,
- TEST_GARDENLINUX_COMMIT,
- False,
- "") == 101
- assert any("Release created successfully" in record.message for record in caplog.records), "Expected a success log record"
+ assert any(
+ "Release created successfully" in record.message
+ for record in caplog.records
+ ), "Expected a success log record"
def test_write_to_release_id_file(release_id_file):
@@ -69,4 +81,6 @@ def test_write_to_release_id_file_broken_file_permissions(release_id_file, caplo
with pytest.raises(SystemExit):
write_to_release_id_file(TEST_GARDENLINUX_RELEASE)
- assert any("Could not create" in record.message for record in caplog.records), "Expected a failure log record"
+ assert any(
+ "Could not create" in record.message for record in caplog.records
+ ), "Expected a failure log record"
diff --git a/tests/github/test_create_github_release_notes.py b/tests/github/test_create_github_release_notes.py
index 0efaae4a..38fc56ba 100644
--- a/tests/github/test_create_github_release_notes.py
+++ b/tests/github/test_create_github_release_notes.py
@@ -126,7 +126,7 @@ class SubmoduleAsRepo(Repo):
"""This will fake a git submodule as a git repository object."""
def __new__(cls, *args, **kwargs):
- r = super().__new__(Repo)
+ r = super().__new__(Repo) # pyright: ignore[reportArgumentType]
r.__init__(*args, **kwargs)
maybe_gl_submodule = [
@@ -144,7 +144,8 @@ def __new__(cls, *args, **kwargs):
return sr
monkeypatch.setattr(
- "gardenlinux.github.release_notes.helpers.Repo", SubmoduleAsRepo
+ "gardenlinux.github.release_notes.helpers.Repo", # pyright: ignore[reportAttributeAccessIssue]
+ SubmoduleAsRepo,
)
import gardenlinux.github
@@ -168,12 +169,10 @@ def __new__(cls, *args, **kwargs):
text=glvd_response_fixture_path.read_text(),
status_code=200,
)
- generated_release_notes = (
- gardenlinux.github.release_notes.create_github_release_notes(
- TEST_GARDENLINUX_RELEASE,
- TEST_GARDENLINUX_COMMIT,
- release_s3_bucket.name,
- )
+ generated_release_notes = gardenlinux.github.release_notes.create_github_release_notes( # pyright: ignore[reportAttributeAccessIssue]
+ TEST_GARDENLINUX_RELEASE,
+ TEST_GARDENLINUX_COMMIT,
+ release_s3_bucket.name,
)
assert generated_release_notes == release_fixture_path.read_text()
diff --git a/tests/github/test_download_metadata_files.py b/tests/github/test_download_metadata_files.py
index 25dc2733..98cf62ba 100644
--- a/tests/github/test_download_metadata_files.py
+++ b/tests/github/test_download_metadata_files.py
@@ -7,7 +7,6 @@
from ..constants import (
RELEASE_NOTES_S3_ARTIFACTS_DIR,
- TEST_GARDENLINUX_COMMIT,
TEST_GARDENLINUX_COMMIT_SHORT,
TEST_GARDENLINUX_RELEASE,
TEST_GARDENLINUX_RELEASE_BUCKET_NAME,
@@ -17,20 +16,16 @@
def test_download_metadata_file(downloads_dir, release_s3_bucket):
release_s3_bucket.upload_file(
RELEASE_NOTES_S3_ARTIFACTS_DIR / "aws-gardener_prod-amd64.s3_metadata.yaml",
- f"meta/singles/test-aws-gardener_prod-amd64-{TEST_GARDENLINUX_RELEASE}-{TEST_GARDENLINUX_COMMIT}",
+ f"meta/singles/test-aws-gardener_prod-amd64-{TEST_GARDENLINUX_RELEASE}-{TEST_GARDENLINUX_COMMIT_SHORT}",
)
s3_artifacts = S3Artifacts(TEST_GARDENLINUX_RELEASE_BUCKET_NAME)
s3_artifacts._bucket = release_s3_bucket
- cname = CName(
- "test-aws-gardener_prod",
- "amd64",
- "{0}-{1}".format(TEST_GARDENLINUX_RELEASE, TEST_GARDENLINUX_COMMIT_SHORT),
- )
+ cname = CName("test-aws-gardener_prod", "amd64", TEST_GARDENLINUX_COMMIT_SHORT)
download_metadata_file(
s3_artifacts,
- cname.cname,
+ cname,
TEST_GARDENLINUX_RELEASE,
TEST_GARDENLINUX_COMMIT_SHORT,
S3_DOWNLOADS_DIR,
@@ -41,18 +36,22 @@ def test_download_metadata_file(downloads_dir, release_s3_bucket):
def test_download_metadata_file_no_such_release(downloads_dir, release_s3_bucket):
release_s3_bucket.upload_file(
RELEASE_NOTES_S3_ARTIFACTS_DIR / "aws-gardener_prod-amd64.s3_metadata.yaml",
- f"meta/singles/test-aws-gardener_prod-amd64-{TEST_GARDENLINUX_RELEASE}-{TEST_GARDENLINUX_COMMIT}",
+ f"meta/singles/test-aws-gardener_prod-amd64-{TEST_GARDENLINUX_RELEASE}-{TEST_GARDENLINUX_COMMIT_SHORT}",
)
s3_artifacts = S3Artifacts(TEST_GARDENLINUX_RELEASE_BUCKET_NAME)
s3_artifacts._bucket = release_s3_bucket
release = "0000.0"
commit = TEST_GARDENLINUX_COMMIT_SHORT
- cname = CName("aws-gardener_prod", "amd64", "{0}-{1}".format(release, commit))
+ cname = CName("aws-gardener_prod", "amd64", commit)
with pytest.raises(IndexError):
download_metadata_file(
- s3_artifacts, cname.cname, release, commit, S3_DOWNLOADS_DIR
+ s3_artifacts,
+ cname,
+ release,
+ TEST_GARDENLINUX_COMMIT_SHORT,
+ S3_DOWNLOADS_DIR,
)
assert not (
S3_DOWNLOADS_DIR / "test-aws-gardener_prod-amd64.s3_metadata.yaml"
@@ -62,7 +61,7 @@ def test_download_metadata_file_no_such_release(downloads_dir, release_s3_bucket
def test_download_metadata_file_no_such_commit(downloads_dir, release_s3_bucket):
release_s3_bucket.upload_file(
RELEASE_NOTES_S3_ARTIFACTS_DIR / "aws-gardener_prod-amd64.s3_metadata.yaml",
- f"meta/singles/test-aws-gardener_prod-amd64-{TEST_GARDENLINUX_RELEASE}-{TEST_GARDENLINUX_COMMIT}",
+ f"meta/singles/test-aws-gardener_prod-amd64-{TEST_GARDENLINUX_RELEASE}-{TEST_GARDENLINUX_COMMIT_SHORT}",
)
s3_artifacts = S3Artifacts(TEST_GARDENLINUX_RELEASE_BUCKET_NAME)
@@ -70,11 +69,15 @@ def test_download_metadata_file_no_such_commit(downloads_dir, release_s3_bucket)
release = TEST_GARDENLINUX_RELEASE
commit = "deadbeef"
- cname = CName("test-aws-gardener_prod", "amd64", "{0}-{1}".format(release, commit))
+ cname = CName("test-aws-gardener_prod", "amd64", commit)
with pytest.raises(IndexError):
download_metadata_file(
- s3_artifacts, cname.cname, release, commit, S3_DOWNLOADS_DIR
+ s3_artifacts,
+ cname,
+ release,
+ commit,
+ S3_DOWNLOADS_DIR,
)
assert not (
S3_DOWNLOADS_DIR / "test-aws-gardener_prod-amd64.s3_metadata.yaml"
@@ -86,7 +89,7 @@ def test_download_metadata_file_no_such_release_and_commit(
):
release_s3_bucket.upload_file(
RELEASE_NOTES_S3_ARTIFACTS_DIR / "aws-gardener_prod-amd64.s3_metadata.yaml",
- f"meta/singles/test-aws-gardener_prod-amd64-{TEST_GARDENLINUX_RELEASE}-{TEST_GARDENLINUX_COMMIT}",
+ f"meta/singles/test-aws-gardener_prod-amd64-{TEST_GARDENLINUX_RELEASE}-{TEST_GARDENLINUX_COMMIT_SHORT}",
)
s3_artifacts = S3Artifacts(TEST_GARDENLINUX_RELEASE_BUCKET_NAME)
@@ -94,11 +97,16 @@ def test_download_metadata_file_no_such_release_and_commit(
release = "0000.0"
commit = "deadbeef"
- cname = CName("test-aws-gardener_prod", "amd64", "{0}-{1}".format(release, commit))
+ cname = CName("test-aws-gardener_prod", "amd64", commit)
+ print(f"{cname.cname=}")
with pytest.raises(IndexError):
download_metadata_file(
- s3_artifacts, cname.cname, release, commit, S3_DOWNLOADS_DIR
+ s3_artifacts,
+ cname,
+ release,
+ TEST_GARDENLINUX_COMMIT_SHORT,
+ S3_DOWNLOADS_DIR,
)
assert not (
S3_DOWNLOADS_DIR / "test-aws-gardener_prod-amd64.s3_metadata.yaml"
diff --git a/tests/github/test_github_script.py b/tests/github/test_github_script.py
index c94885a4..14c55698 100644
--- a/tests/github/test_github_script.py
+++ b/tests/github/test_github_script.py
@@ -15,64 +15,129 @@ def test_script_parse_args_wrong_command(monkeypatch, capfd):
gh.main()
captured = capfd.readouterr()
- assert "argument command: invalid choice: 'rejoice'" in captured.err, "Expected help message printed"
+ assert (
+ "argument command: invalid choice: 'rejoice'" in captured.err
+ ), "Expected help message printed"
def test_script_parse_args_create_command_required_args(monkeypatch, capfd):
- monkeypatch.setattr(sys, "argv", ["gh", "create", "--owner", "gardenlinux", "--repo", "gardenlinux"])
+ monkeypatch.setattr(
+ sys, "argv", ["gh", "create", "--owner", "gardenlinux", "--repo", "gardenlinux"]
+ )
with pytest.raises(SystemExit):
gh.main()
captured = capfd.readouterr()
- assert "the following arguments are required: --tag, --commit" in captured.err, \
- "Expected help message on missing arguments for 'create' command"
+ assert (
+ "the following arguments are required: --tag, --commit" in captured.err
+ ), "Expected help message on missing arguments for 'create' command"
def test_script_parse_args_upload_command_required_args(monkeypatch, capfd):
- monkeypatch.setattr(sys, "argv", ["gh", "upload", "--owner", "gardenlinux", "--repo", "gardenlinux"])
+ monkeypatch.setattr(
+ sys, "argv", ["gh", "upload", "--owner", "gardenlinux", "--repo", "gardenlinux"]
+ )
with pytest.raises(SystemExit):
gh.main()
captured = capfd.readouterr()
- assert "the following arguments are required: --release_id, --file_path" in captured.err, \
- "Expected help message on missing arguments for 'upload' command"
+ assert (
+ "the following arguments are required: --release_id, --file_path"
+ in captured.err
+ ), "Expected help message on missing arguments for 'upload' command"
def test_script_create_dry_run(monkeypatch, capfd):
- monkeypatch.setattr(sys, "argv", ["gh", "create", "--owner", "gardenlinux", "--repo",
- "gardenlinux", "--tag", TEST_GARDENLINUX_RELEASE, "--commit", TEST_GARDENLINUX_COMMIT, "--dry-run"])
- monkeypatch.setattr("gardenlinux.github.__main__.create_github_release_notes",
- lambda tag, commit, bucket: f"{tag} {commit} {bucket}")
+ monkeypatch.setattr(
+ sys,
+ "argv",
+ [
+ "gh",
+ "create",
+ "--owner",
+ "gardenlinux",
+ "--repo",
+ "gardenlinux",
+ "--tag",
+ TEST_GARDENLINUX_RELEASE,
+ "--commit",
+ TEST_GARDENLINUX_COMMIT,
+ "--dry-run",
+ ],
+ )
+ monkeypatch.setattr(
+ "gardenlinux.github.__main__.create_github_release_notes",
+ lambda tag, commit, bucket: f"{tag} {commit} {bucket}",
+ )
gh.main()
captured = capfd.readouterr()
- assert captured.out == f"Dry Run ...\nThis release would be created:\n{TEST_GARDENLINUX_RELEASE} {TEST_GARDENLINUX_COMMIT} {GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME}\n", \
- "Expected dry-run create to return generated release notes text"
+ assert (
+ captured.out
+ == f"Dry Run ...\nThis release would be created:\n{TEST_GARDENLINUX_RELEASE} {TEST_GARDENLINUX_COMMIT} {GARDENLINUX_GITHUB_RELEASE_BUCKET_NAME}\n"
+ ), "Expected dry-run create to return generated release notes text"
def test_script_create(monkeypatch, caplog):
- monkeypatch.setattr(sys, "argv", ["gh", "create", "--owner", "gardenlinux", "--repo",
- "gardenlinux", "--tag", TEST_GARDENLINUX_RELEASE, "--commit", TEST_GARDENLINUX_COMMIT])
- monkeypatch.setattr("gardenlinux.github.__main__.create_github_release_notes",
- lambda tag, commit, bucket: f"{tag} {commit} {bucket}")
- monkeypatch.setattr("gardenlinux.github.__main__.create_github_release",
- lambda a1, a2, a3, a4, a5, a6: TEST_GARDENLINUX_RELEASE)
+ monkeypatch.setattr(
+ sys,
+ "argv",
+ [
+ "gh",
+ "create",
+ "--owner",
+ "gardenlinux",
+ "--repo",
+ "gardenlinux",
+ "--tag",
+ TEST_GARDENLINUX_RELEASE,
+ "--commit",
+ TEST_GARDENLINUX_COMMIT,
+ ],
+ )
+ monkeypatch.setattr(
+ "gardenlinux.github.__main__.create_github_release_notes",
+ lambda tag, commit, bucket: f"{tag} {commit} {bucket}",
+ )
+ monkeypatch.setattr(
+ "gardenlinux.github.__main__.create_github_release",
+ lambda a1, a2, a3, a4, a5, a6: TEST_GARDENLINUX_RELEASE,
+ )
gh.main()
- assert any(f"Release created with ID: {TEST_GARDENLINUX_RELEASE}" in record.message for record in caplog.records), \
- "Expected a release creation confirmation log entry"
+ assert any(
+ f"Release created with ID: {TEST_GARDENLINUX_RELEASE}" in record.message
+ for record in caplog.records
+ ), "Expected a release creation confirmation log entry"
def test_script_upload_dry_run(monkeypatch, capfd):
- monkeypatch.setattr(sys, "argv", ["gh", "upload", "--owner", "gardenlinux", "--repo",
- "gardenlinux", "--release_id", TEST_GARDENLINUX_RELEASE, "--file_path", "foo", "--dry-run"])
- monkeypatch.setattr("gardenlinux.github.__main__.upload_to_github_release_page",
- lambda a1, a2, a3, a4, dry_run: print(f"dry-run: {dry_run}"))
+ monkeypatch.setattr(
+ sys,
+ "argv",
+ [
+ "gh",
+ "upload",
+ "--owner",
+ "gardenlinux",
+ "--repo",
+ "gardenlinux",
+ "--release_id",
+ TEST_GARDENLINUX_RELEASE,
+ "--file_path",
+ "foo",
+ "--dry-run",
+ ],
+ )
+ monkeypatch.setattr(
+ "gardenlinux.github.__main__.upload_to_github_release_page",
+ lambda a1, a2, a3, a4, dry_run: print(f"dry-run: {dry_run}"),
+ )
gh.main()
captured = capfd.readouterr()
diff --git a/tests/github/test_upload_to_github_release_page.py b/tests/github/test_upload_to_github_release_page.py
index 152b3d87..09596c7f 100644
--- a/tests/github/test_upload_to_github_release_page.py
+++ b/tests/github/test_upload_to_github_release_page.py
@@ -12,16 +12,24 @@
def test_upload_to_github_release_page_dryrun(caplog, artifact_for_upload):
with requests_mock.Mocker():
- assert upload_to_github_release_page(
- "gardenlinux",
- "gardenlinux",
- TEST_GARDENLINUX_RELEASE,
- artifact_for_upload,
- dry_run=True) is None
- assert any("Dry run: would upload" in record.message for record in caplog.records), "Expected a dry‑run log entry"
+ assert (
+ upload_to_github_release_page(
+ "gardenlinux",
+ "gardenlinux",
+ TEST_GARDENLINUX_RELEASE,
+ artifact_for_upload,
+ dry_run=True,
+ )
+ is None
+ )
+ assert any(
+ "Dry run: would upload" in record.message for record in caplog.records
+ ), "Expected a dry‑run log entry"
-def test_upload_to_github_release_page_needs_github_token(downloads_dir, artifact_for_upload):
+def test_upload_to_github_release_page_needs_github_token(
+ downloads_dir, artifact_for_upload
+):
with requests_mock.Mocker():
with pytest.raises(ValueError) as exn:
upload_to_github_release_page(
@@ -29,17 +37,21 @@ def test_upload_to_github_release_page_needs_github_token(downloads_dir, artifac
"gardenlinux",
TEST_GARDENLINUX_RELEASE,
artifact_for_upload,
- dry_run=False)
- assert str(exn.value) == "GITHUB_TOKEN environment variable not set", \
- "Expected an exception to be raised on missing GITHUB_TOKEN environment variable"
+ dry_run=False,
+ )
+ assert (
+ str(exn.value) == "GITHUB_TOKEN environment variable not set"
+ ), "Expected an exception to be raised on missing GITHUB_TOKEN environment variable"
-def test_upload_to_github_release_page(downloads_dir, caplog, github_token, artifact_for_upload):
+def test_upload_to_github_release_page(
+ downloads_dir, caplog, github_token, artifact_for_upload
+):
with requests_mock.Mocker(real_http=True) as m:
m.post(
f"https://uploads.github.com/repos/gardenlinux/gardenlinux/releases/{TEST_GARDENLINUX_RELEASE}/assets?name=artifact.log",
text="{}",
- status_code=201
+ status_code=201,
)
upload_to_github_release_page(
@@ -47,12 +59,16 @@ def test_upload_to_github_release_page(downloads_dir, caplog, github_token, arti
"gardenlinux",
TEST_GARDENLINUX_RELEASE,
artifact_for_upload,
- dry_run=False)
- assert any("Upload successful" in record.message for record in caplog.records), \
- "Expected an upload confirmation log entry"
+ dry_run=False,
+ )
+ assert any(
+ "Upload successful" in record.message for record in caplog.records
+ ), "Expected an upload confirmation log entry"
-def test_upload_to_github_release_page_unreadable_artifact(downloads_dir, caplog, github_token, artifact_for_upload):
+def test_upload_to_github_release_page_unreadable_artifact(
+ downloads_dir, caplog, github_token, artifact_for_upload
+):
artifact_for_upload.chmod(0)
upload_to_github_release_page(
@@ -60,17 +76,21 @@ def test_upload_to_github_release_page_unreadable_artifact(downloads_dir, caplog
"gardenlinux",
TEST_GARDENLINUX_RELEASE,
artifact_for_upload,
- dry_run=False)
- assert any("Error reading file" in record.message for record in caplog.records), \
- "Expected an error message log entry"
+ dry_run=False,
+ )
+ assert any(
+ "Error reading file" in record.message for record in caplog.records
+ ), "Expected an error message log entry"
-def test_upload_to_github_release_page_failed(downloads_dir, caplog, github_token, artifact_for_upload):
+def test_upload_to_github_release_page_failed(
+ downloads_dir, caplog, github_token, artifact_for_upload
+):
with requests_mock.Mocker(real_http=True) as m:
m.post(
f"https://uploads.github.com/repos/gardenlinux/gardenlinux/releases/{TEST_GARDENLINUX_RELEASE}/assets?name=artifact.log",
text="{}",
- status_code=503
+ status_code=503,
)
with pytest.raises(requests.exceptions.HTTPError):
@@ -79,9 +99,12 @@ def test_upload_to_github_release_page_failed(downloads_dir, caplog, github_toke
"gardenlinux",
TEST_GARDENLINUX_RELEASE,
artifact_for_upload,
- dry_run=False)
- assert any("Upload failed with status code 503:" in record.message for record in caplog.records), \
- "Expected an error HTTP status code to be logged"
+ dry_run=False,
+ )
+ assert any(
+ "Upload failed with status code 503:" in record.message
+ for record in caplog.records
+ ), "Expected an error HTTP status code to be logged"
def test_script_parse_args_wrong_command(monkeypatch, capfd):
@@ -91,25 +114,48 @@ def test_script_parse_args_wrong_command(monkeypatch, capfd):
gh.main()
captured = capfd.readouterr()
- assert "argument command: invalid choice: 'rejoice'" in captured.err, "Expected help message printed"
+ assert (
+ "argument command: invalid choice: 'rejoice'" in captured.err
+ ), "Expected help message printed"
def test_script_parse_args_upload_command_required_args(monkeypatch, capfd):
- monkeypatch.setattr(sys, "argv", ["gh", "upload", "--owner", "gardenlinux", "--repo", "gardenlinux"])
+ monkeypatch.setattr(
+ sys, "argv", ["gh", "upload", "--owner", "gardenlinux", "--repo", "gardenlinux"]
+ )
with pytest.raises(SystemExit):
gh.main()
captured = capfd.readouterr()
- assert "the following arguments are required: --release_id, --file_path" in captured.err, \
- "Expected help message on missing arguments for 'upload' command"
+ assert (
+ "the following arguments are required: --release_id, --file_path"
+ in captured.err
+ ), "Expected help message on missing arguments for 'upload' command"
def test_script_upload_dry_run(monkeypatch, capfd):
- monkeypatch.setattr(sys, "argv", ["gh", "upload", "--owner", "gardenlinux", "--repo",
- "gardenlinux", "--release_id", TEST_GARDENLINUX_RELEASE, "--file_path", "foo", "--dry-run"])
- monkeypatch.setattr("gardenlinux.github.__main__.upload_to_github_release_page",
- lambda a1, a2, a3, a4, dry_run: print(f"dry-run: {dry_run}"))
+ monkeypatch.setattr(
+ sys,
+ "argv",
+ [
+ "gh",
+ "upload",
+ "--owner",
+ "gardenlinux",
+ "--repo",
+ "gardenlinux",
+ "--release_id",
+ TEST_GARDENLINUX_RELEASE,
+ "--file_path",
+ "foo",
+ "--dry-run",
+ ],
+ )
+ monkeypatch.setattr(
+ "gardenlinux.github.__main__.upload_to_github_release_page",
+ lambda a1, a2, a3, a4, dry_run: print(f"dry-run: {dry_run}"),
+ )
gh.main()
captured = capfd.readouterr()
diff --git a/tests/helper.py b/tests/helper.py
index e0034f0f..7d9a82c7 100644
--- a/tests/helper.py
+++ b/tests/helper.py
@@ -1,9 +1,6 @@
-import os
import shlex
import subprocess
-from .constants import CERT_DIR, GL_ROOT_DIR, ZOT_CONFIG_FILE
-
def spawn_background_process(cmd, stdout=None, stderr=None):
args = shlex.split(cmd)
diff --git a/tests/oci/test_container.py b/tests/oci/test_container.py
index 2465fac9..b386438c 100644
--- a/tests/oci/test_container.py
+++ b/tests/oci/test_container.py
@@ -1,6 +1,3 @@
-import io
-import json
-import logging
from base64 import b64encode
import pytest
diff --git a/tests/oci/test_index.py b/tests/oci/test_index.py
index c2b34ec8..3a4904ed 100644
--- a/tests/oci/test_index.py
+++ b/tests/oci/test_index.py
@@ -1,4 +1,3 @@
-import io
import json
import pytest
diff --git a/tests/oci/test_layer.py b/tests/oci/test_layer.py
index 85df0b63..15fca532 100644
--- a/tests/oci/test_layer.py
+++ b/tests/oci/test_layer.py
@@ -1,6 +1,3 @@
-import builtins
-from pathlib import Path
-
import pytest
import gardenlinux.oci.layer as gl_layer