diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml index 2edb9955..117d0af9 100644 --- a/.semaphore/semaphore.yml +++ b/.semaphore/semaphore.yml @@ -26,7 +26,7 @@ blocks: - name: docker prologue: commands: - - sem-version python 3.9 + - sem-version python 3.12 - checkout - docker login --username "${DOCKER_USERNAME}" --password-stdin <<< "${DOCKER_PASSWORD}" - pip install .[ci] @@ -44,7 +44,7 @@ blocks: task: prologue: commands: - - sem-version python 3.9 + - sem-version python 3.12 - checkout - pip install .[ci] - mkdir -p "$HOME/.local/bin" diff --git a/Dockerfile b/Dockerfile index 4af5531a..c998707e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -FROM python:3.9-alpine3.16 as common +FROM python:3.12-alpine as common MAINTAINER fiaas@googlegroups.com # Install any binary package dependencies here RUN apk --no-cache add \ diff --git a/fiaas_deploy_daemon/crd/status.py b/fiaas_deploy_daemon/crd/status.py index a5274828..ee9a182d 100644 --- a/fiaas_deploy_daemon/crd/status.py +++ b/fiaas_deploy_daemon/crd/status.py @@ -16,9 +16,8 @@ import logging import struct from base64 import b32encode -from datetime import datetime +from datetime import datetime, timezone -import pytz from blinker import signal from py27hash.hash import hash27 from k8s.client import NotFound @@ -43,9 +42,7 @@ def connect_signals(include_status_in_app): def now(): - now = datetime.utcnow() - now = pytz.utc.localize(now) - return now.isoformat() + return datetime.now(timezone.utc).isoformat() def _handle_signal_without_status(sender, status, subject): diff --git a/fiaas_deploy_daemon/specs/v3/factory.py b/fiaas_deploy_daemon/specs/v3/factory.py index 4a254f75..86f33336 100644 --- a/fiaas_deploy_daemon/specs/v3/factory.py +++ b/fiaas_deploy_daemon/specs/v3/factory.py @@ -70,7 +70,7 @@ def __call__( if ( app_config.get("extensions") and app_config["extensions"].get("tls") - and type(app_config["extensions"]["tls"]) == bool + and isinstance(app_config["extensions"]["tls"], bool) ): app_config["extensions"]["tls"] = {"enabled": app_config["extensions"]["tls"]} lookup = LookupMapping(config=app_config, defaults=self._defaults) diff --git a/setup.py b/setup.py index c8834e76..0e82c136 100755 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ def read(filename): "decorator < 5.0.0", # 5.0.0 and later drops py2 support (transitive dep from pinject) "six >= 1.12.0", "dnspython == 1.16.0", - "k8s == 0.25.0", + "k8s == 0.26.0", "appdirs == 1.4.3", "requests-toolbelt == 0.10.1", "backoff == 1.8.0", @@ -60,23 +60,23 @@ def read(filename): "flake8-print == 3.1.4", "flake8-comprehensions == 1.4.1", "pep8-naming == 0.11.1", - "flake8 == 3.9.0", + "flake8 == 7.0.0", ] TESTS_REQ = [ - "pytest-xdist == 3.3.1", - "pytest-sugar == 0.9.7", + "pytest-xdist == 3.6.1", + "pytest-sugar == 1.0.0", "pytest-html == 4.1.1", - "pytest-cov == 4.1.0", + "pytest-cov == 5.0.0", "pytest-helpers-namespace == 2021.12.29", - "pytest == 7.4.2", + "pytest == 8.2.0", "requests-file == 1.4.3", "callee == 0.3.1", ] DEV_TOOLS = [ - "tox==3.14.5", - "virtualenv==20.13.0", + "tox==4.14.2", + "virtualenv==20.26.0", "black ~= 22.0", ] diff --git a/tests/conftest.py b/tests/conftest.py index 5af41e1a..0fc5b64e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -99,7 +99,7 @@ def _add_argument_diff(actual, expected, indent=0, acc=None): if not acc: acc = ["Actual vs Expected"] first = True - if type(actual) != type(expected): + if not isinstance(actual, type(expected)): acc.append("{}{!r} {} {!r}".format(" " * indent * 2, actual, "==" if actual == expected else "!=", expected)) elif isinstance(actual, dict): for k in set(list(actual.keys()) + list(expected.keys())): diff --git a/tests/fiaas_deploy_daemon/crd/test_crd_status.py b/tests/fiaas_deploy_daemon/crd/test_crd_status.py index c8384337..13d31e75 100644 --- a/tests/fiaas_deploy_daemon/crd/test_crd_status.py +++ b/tests/fiaas_deploy_daemon/crd/test_crd_status.py @@ -52,7 +52,7 @@ def get_or_create(self): @pytest.fixture def get_app(self): - with mock.patch("fiaas_deploy_daemon.crd.status.FiaasApplication.get", spec_set=True) as m: + with mock.patch("fiaas_deploy_daemon.crd.status.FiaasApplication.get", autospec=True) as m: yield m @pytest.fixture diff --git a/tests/fiaas_deploy_daemon/deployer/kubernetes/test_role_binding.py b/tests/fiaas_deploy_daemon/deployer/kubernetes/test_role_binding.py index 6ddae655..d33c2a53 100644 --- a/tests/fiaas_deploy_daemon/deployer/kubernetes/test_role_binding.py +++ b/tests/fiaas_deploy_daemon/deployer/kubernetes/test_role_binding.py @@ -110,7 +110,7 @@ def test_create_bindings_with_role_in_role_bindings_owned_by_fiaas_as_cluster_ro owner_references.apply.assert_called() def test_create_bindings_with_multiple_cases(self, deployer, owner_references, app_spec, r_a_role_binding, cr_a_role_binding): - with patch.object(RoleBinding, 'save') as mock_save: + with patch.object(RoleBinding, 'save', autospec=True) as mock_save: cr_a_role_binding.metadata = ObjectMeta(ownerReferences=[ OwnerReference(apiVersion="fiaas.schibsted.io/v1", kind="Application")]) r_a_role_binding.metadata = ObjectMeta(ownerReferences=[ diff --git a/tox.ini b/tox.ini index 1a2d62fe..c383a8d0 100644 --- a/tox.ini +++ b/tox.ini @@ -2,8 +2,8 @@ envlist = codestyle,test,integration_test [testenv] -basepython=python3.9 -envdir={toxworkdir}/py39 +basepython=python3.12 +envdir={toxworkdir}/py312 usedevelop=True deps=.[dev] setenv =