Skip to content

Commit

Permalink
Merge pull request #244 from fiaas/je/py312
Browse files Browse the repository at this point in the history
Je/py312
  • Loading branch information
blockjesper authored May 3, 2024
2 parents cd6960c + c02a524 commit 52fb5bb
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
7 changes: 2 additions & 5 deletions fiaas_deploy_daemon/crd/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion fiaas_deploy_daemon/specs/v3/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 8 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
]

Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())):
Expand Down
2 changes: 1 addition & 1 deletion tests/fiaas_deploy_daemon/crd/test_crd_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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=[
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit 52fb5bb

Please sign in to comment.