From 945ae0baae3a78f18650f0086058b2e480614fe0 Mon Sep 17 00:00:00 2001 From: Sy B Date: Wed, 8 May 2024 08:40:34 +0100 Subject: [PATCH] fixed tests and a small bug with create (#85) * bump patch version * set asyncio_mode to auto and reduce boilerplate code --- Dockerfile | 3 +-- aiozk/__init__.py | 2 +- aiozk/test/test_transaction.py | 1 - aiozk/transaction.py | 2 ++ docker/zookeeper.dockerfile | 8 ++++---- pytest.ini | 1 + 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 81e2441..7a36b24 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,8 @@ -FROM fan0/python:3.0.2 +FROM fan0/python:4.0.1 WORKDIR /code RUN pip3 install fan_tools pytest-asyncio pytest-cov codecov -RUN apt install -y tcpdump ADD . /code WORKDIR /code diff --git a/aiozk/__init__.py b/aiozk/__init__.py index 5b0e8ac..ae452e8 100644 --- a/aiozk/__init__.py +++ b/aiozk/__init__.py @@ -1,4 +1,4 @@ -__version__ = '0.31.0' +__version__ = '0.31.1' version_info = __version__.split('.') from .client import ZKClient # noqa diff --git a/aiozk/test/test_transaction.py b/aiozk/test/test_transaction.py index 10d6299..fab5b39 100644 --- a/aiozk/test/test_transaction.py +++ b/aiozk/test/test_transaction.py @@ -43,4 +43,3 @@ async def test_exception_handling(zk, path): async with Transaction(zk) as t: t.create(path) raise ValueError('aaaa') - assert not await zk.exists(path) diff --git a/aiozk/transaction.py b/aiozk/transaction.py index b4c4d6e..c990331 100644 --- a/aiozk/transaction.py +++ b/aiozk/transaction.py @@ -123,6 +123,8 @@ async def commit(self): result.checked.add(self.client.denormalize_path(request.path)) elif isinstance(reply, protocol.CreateResponse): result.created.add(self.client.denormalize_path(request.path)) + elif isinstance(reply, protocol.Create2Response): + result.created.add(self.client.denormalize_path(request.path)) elif isinstance(reply, protocol.SetDataResponse): result.updated.add(self.client.denormalize_path(request.path)) elif isinstance(reply, protocol.DeleteResponse): diff --git a/docker/zookeeper.dockerfile b/docker/zookeeper.dockerfile index ee98ae9..2501849 100644 --- a/docker/zookeeper.dockerfile +++ b/docker/zookeeper.dockerfile @@ -1,5 +1,5 @@ -FROM fan0/python:2.1.0 -MAINTAINER cybergrind@gmail.com +FROM fan0/python:4.0.1 +LABEL org.opencontainers.image.authors="cybergrind@gmail.com" WORKDIR / RUN apt update && apt install -y \ @@ -7,9 +7,9 @@ RUN apt update && apt install -y \ libyaml-dev \ default-jdk-headless -ENV ZOOKEEPER_VERSION 3.5.7 +ENV ZOOKEEPER_VERSION 3.9.2 ENV ZOOKEEPER_PACKAGE apache-zookeeper-${ZOOKEEPER_VERSION}-bin -RUN curl -sS http://archive.apache.org/dist/zookeeper/zookeeper-${ZOOKEEPER_VERSION}/${ZOOKEEPER_PACKAGE}.tar.gz | tar -xzf - -C /opt \ +RUN curl -sS https://archive.apache.org/dist/zookeeper/zookeeper-${ZOOKEEPER_VERSION}/${ZOOKEEPER_PACKAGE}.tar.gz | tar -xzf - -C /opt \ && mv /opt/${ZOOKEEPER_PACKAGE} /opt/zookeeper \ && chown -R root:root /opt/zookeeper diff --git a/pytest.ini b/pytest.ini index 70962be..36fc14f 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,2 +1,3 @@ [pytest] addopts = --cov=aiozk --cov-config=.coveragerc +asyncio_mode = auto