Skip to content

Commit

Permalink
tests: fix ruff complaints and switch to bash
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Spooren <[email protected]>
  • Loading branch information
aparcar committed Feb 20, 2024
1 parent 02088b0 commit 9eb8179
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
1 change: 0 additions & 1 deletion asu/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from asu.package_changes import appy_package_changes

log = logging.getLogger("rq.worker")
log.setLevel(logging.DEBUG)


def build(req: dict, job=None):
Expand Down
1 change: 0 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import prometheus_client
import pytest
from fakeredis import FakeStrictRedis
from pytest import MonkeyPatch

from asu.asu import create_app

Expand Down
22 changes: 18 additions & 4 deletions tests/test_common.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
import os
import tempfile
from os import getenv
from pathlib import Path, PosixPath
from pathlib import Path

from asu.common import *
from podman import PodmanClient

from asu.common import (
check_manifest,
diff_packages,
fingerprint_pubkey_usign,
get_container_version_tag,
get_file_hash,
get_packages_hash,
get_request_hash,
get_str_hash,
run_container,
verify_usign,
)


def test_get_str_hash():
Expand Down Expand Up @@ -32,6 +44,8 @@ def test_get_request_hash():
"package_hash": get_packages_hash(["test"]),
}

assert get_request_hash(request) == "c4eb8bfd4bbd07d7cd2adf70d7ea02e4"


def test_diff_packages():
assert diff_packages({"test1"}, {"test1", "test2"}) == ["-test2", "test1"]
Expand Down Expand Up @@ -76,7 +90,7 @@ def test_get_version_container_tag():


def test_check_manifest():
assert check_manifest({"test": "1.0"}, {"test": "1.0"}) == None
assert check_manifest({"test": "1.0"}, {"test": "1.0"}) is None
assert (
check_manifest({"test": "1.0"}, {"test": "2.0"})
== "Impossible package selection: test version not as requested: 2.0 vs. 1.0"
Expand Down
5 changes: 3 additions & 2 deletions tests/test_package_changes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import pytest

from asu.package_changes import appy_package_changes


Expand Down Expand Up @@ -52,6 +50,9 @@ def test_apply_package_changes_release():
original_req = req.copy()
appy_package_changes(req)

assert req == original_req


def test_apply_package_changes_mediatek():
req = {
"version": "23.05",
Expand Down
3 changes: 0 additions & 3 deletions tests/test_stats.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from prometheus_client import REGISTRY


def test_stats_image_builds(client):
response = client.post(
"/api/v1/build",
Expand Down

0 comments on commit 9eb8179

Please sign in to comment.