From bb899dcc0b6e815765e95645f1f84f80e26b427b Mon Sep 17 00:00:00 2001 From: Jonatan Martens Date: Sun, 23 Aug 2020 12:27:54 +0300 Subject: [PATCH 1/2] Changed name from zeebepy to pyzeebe --- .github/workflows/publish-python-package.yml | 2 +- .github/workflows/test-python-package.yml | 5 +-- Pipfile | 2 +- Pipfile.lock | 10 +++--- README.md | 28 +++++++-------- examples/worker.py | 2 +- pyzeebe/__init__.py | 4 +++ {zeebepy => pyzeebe}/common/__init__.py | 0 {zeebepy => pyzeebe}/common/exceptions.py | 0 {zeebepy => pyzeebe}/common/random_utils.py | 4 +-- {zeebepy => pyzeebe}/decorators/__init__.py | 0 .../decorators/zeebe_decorator_base.py | 2 +- .../decorators/zeebe_decorator_base_test.py | 4 +-- .../grpc_internals/__init__.py | 0 .../grpc_internals/zeebe_adapter.py | 6 ++-- .../grpc_internals/zeebe_adapter_test.py | 12 +++---- .../grpc_internals/zeebe_pb2.py | 0 .../grpc_internals/zeebe_pb2_grpc.py | 2 +- {zeebepy => pyzeebe}/task/__init__.py | 0 {zeebepy => pyzeebe}/task/task.py | 6 ++-- {zeebepy => pyzeebe}/task/task_context.py | 0 {zeebepy => pyzeebe}/task/task_decorator.py | 2 +- .../task/task_status_controller.py | 4 +-- .../task/task_status_controller_test.py | 12 +++---- {zeebepy => pyzeebe}/task/task_test.py | 2 +- {zeebepy => pyzeebe}/worker/__init__.py | 0 {zeebepy => pyzeebe}/worker/worker.py | 14 ++++---- {zeebepy => pyzeebe}/worker/worker_test.py | 34 +++++++++---------- setup.py | 2 +- zeebepy/__init__.py | 4 --- 30 files changed, 80 insertions(+), 83 deletions(-) create mode 100644 pyzeebe/__init__.py rename {zeebepy => pyzeebe}/common/__init__.py (100%) rename {zeebepy => pyzeebe}/common/exceptions.py (100%) rename {zeebepy => pyzeebe}/common/random_utils.py (90%) rename {zeebepy => pyzeebe}/decorators/__init__.py (100%) rename {zeebepy => pyzeebe}/decorators/zeebe_decorator_base.py (89%) rename {zeebepy => pyzeebe}/decorators/zeebe_decorator_base_test.py (91%) rename {zeebepy => pyzeebe}/grpc_internals/__init__.py (100%) rename {zeebepy => pyzeebe}/grpc_internals/zeebe_adapter.py (97%) rename {zeebepy => pyzeebe}/grpc_internals/zeebe_adapter_test.py (93%) rename {zeebepy => pyzeebe}/grpc_internals/zeebe_pb2.py (100%) rename {zeebepy => pyzeebe}/grpc_internals/zeebe_pb2_grpc.py (99%) rename {zeebepy => pyzeebe}/task/__init__.py (100%) rename {zeebepy => pyzeebe}/task/task.py (82%) rename {zeebepy => pyzeebe}/task/task_context.py (100%) rename {zeebepy => pyzeebe}/task/task_decorator.py (62%) rename {zeebepy => pyzeebe}/task/task_status_controller.py (83%) rename {zeebepy => pyzeebe}/task/task_status_controller_test.py (77%) rename {zeebepy => pyzeebe}/task/task_test.py (97%) rename {zeebepy => pyzeebe}/worker/__init__.py (100%) rename {zeebepy => pyzeebe}/worker/worker.py (92%) rename {zeebepy => pyzeebe}/worker/worker_test.py (85%) delete mode 100644 zeebepy/__init__.py diff --git a/.github/workflows/publish-python-package.yml b/.github/workflows/publish-python-package.yml index 195ed797..8057a51a 100644 --- a/.github/workflows/publish-python-package.yml +++ b/.github/workflows/publish-python-package.yml @@ -1,4 +1,4 @@ -name: Publish zeebepy +name: Publish pyzeebe on: release: diff --git a/.github/workflows/test-python-package.yml b/.github/workflows/test-python-package.yml index 6aed4845..b7339cea 100644 --- a/.github/workflows/test-python-package.yml +++ b/.github/workflows/test-python-package.yml @@ -1,7 +1,4 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: Test zeebepy +name: Test pyzeebe on: push: diff --git a/Pipfile b/Pipfile index 5d0d85d3..dcd5292b 100644 --- a/Pipfile +++ b/Pipfile @@ -10,9 +10,9 @@ coverage = "~=5.2.1" pytest = "~=6.0.1" pytest-grpc = "~=0.8.0" mypy = "~=0.782" -zeebepy = {editable = true, path = "."} coveralls = "~=2.1.2" importlib-metadata = "~=1.7.0" +pyzeebe = {editable = true, path = "."} [packages] grpcio = "~=1.31.0" diff --git a/Pipfile.lock b/Pipfile.lock index 191e3235..b88a6db9 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "8c4166d32e85a7cb347cba7feb118f85099f7e3620539908cc3b4f82309ec295" + "sha256": "4da03aba2dccc4f8850ca3c6cdc3f94e08d344e3bba9607bbda122a48283866a" }, "pipfile-spec": 6, "requires": {}, @@ -364,6 +364,10 @@ "index": "pypi", "version": "==0.8.0" }, + "pyzeebe": { + "editable": true, + "path": "." + }, "requests": { "hashes": [ "sha256:b3559a131db72c33ee969480840fff4bb6dd111de7dd27c8ee1f820f4f00231b", @@ -435,10 +439,6 @@ ], "version": "==1.12.1" }, - "zeebepy": { - "editable": true, - "path": "." - }, "zipp": { "hashes": [ "sha256:aa36550ff0c0b7ef7fa639055d797116ee891440eac1a56f378e2d3179e0320b", diff --git a/README.md b/README.md index 4ec8bec1..62878135 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,34 @@ -[![Coverage Status](https://coveralls.io/repos/github/JonatanMartens/zeebepy/badge.svg?branch=master)](https://coveralls.io/github/JonatanMartens/zeebepy?branch=master) -![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/JonatanMartens/zeebepy/Test%20zeebepy/master) -![GitHub issues](https://img.shields.io/github/issues-raw/JonatanMartens/zeebepy) -![GitHub pull requests](https://img.shields.io/github/issues-pr-raw/JonatanMartens/zeebepy) -![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed-raw/JonatanMartens/zeebepy) -![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/JonatanMartens/zeebepy) -![PyPI - Python Version](https://img.shields.io/pypi/pyversions/zeebepy) -![PyPI](https://img.shields.io/pypi/v/zeebepy) +[![Coverage Status](https://coveralls.io/repos/github/JonatanMartens/pyzeebe/badge.svg?branch=master)](https://coveralls.io/github/JonatanMartens/pyzeebe?branch=master) +![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/JonatanMartens/pyzeebe/Test%20pyzeebe/master) +![GitHub issues](https://img.shields.io/github/issues-raw/JonatanMartens/pyzeebe) +![GitHub pull requests](https://img.shields.io/github/issues-pr-raw/JonatanMartens/pyzeebe) +![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed-raw/JonatanMartens/pyzeebe) +![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/JonatanMartens/pyzeebe) +![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pyzeebe) +![PyPI](https://img.shields.io/pypi/v/pyzeebe) -# Zeebepy -Zeebepy is a python grpc client for Zeebe. +# Pyzeebe +pyzeebe is a python grpc client for Zeebe. Zeebe version support: -| Zeebepy version | Tested Zeebe versions | +| Pyzeebe version | Tested Zeebe versions | |:---------------:|----------------| | 1.0.1 | 0.24.2 | ## Getting Started To install: -`pip install zeebepy` +`pip install pyzeebe` ## Usage ### Worker ```python -from zeebepy import ZeebeWorker, Task, TaskStatusController, TaskContext +from pyzeebe import ZeebeWorker, Task, TaskStatusController, TaskContext def example_task(input: str): return {'output': f'Hello world, {input}!'} @@ -49,7 +49,7 @@ worker.work() # Now every time that a task with type example is called example_t ``` ## Tests -Use the package manager [pip](https://pip.pypa.io/en/stable/) to install zeebepy +Use the package manager [pip](https://pip.pypa.io/en/stable/) to install pyzeebe `pytest .` diff --git a/examples/worker.py b/examples/worker.py index 852cf7e4..b4b48a3d 100644 --- a/examples/worker.py +++ b/examples/worker.py @@ -1,6 +1,6 @@ from typing import Dict -from zeebepy import Task, TaskContext, TaskStatusController, ZeebeWorker +from pyzeebe import Task, TaskContext, TaskStatusController, ZeebeWorker def example_task(input: str) -> Dict: diff --git a/pyzeebe/__init__.py b/pyzeebe/__init__.py new file mode 100644 index 00000000..409aa4eb --- /dev/null +++ b/pyzeebe/__init__.py @@ -0,0 +1,4 @@ +from pyzeebe.task.task import Task +from pyzeebe.task.task_context import TaskContext +from pyzeebe.task.task_status_controller import TaskStatusController +from pyzeebe.worker.worker import ZeebeWorker diff --git a/zeebepy/common/__init__.py b/pyzeebe/common/__init__.py similarity index 100% rename from zeebepy/common/__init__.py rename to pyzeebe/common/__init__.py diff --git a/zeebepy/common/exceptions.py b/pyzeebe/common/exceptions.py similarity index 100% rename from zeebepy/common/exceptions.py rename to pyzeebe/common/exceptions.py diff --git a/zeebepy/common/random_utils.py b/pyzeebe/common/random_utils.py similarity index 90% rename from zeebepy/common/random_utils.py rename to pyzeebe/common/random_utils.py index e10dca37..7c48e4d3 100644 --- a/zeebepy/common/random_utils.py +++ b/pyzeebe/common/random_utils.py @@ -1,8 +1,8 @@ from random import randint from uuid import uuid4 -from zeebepy.task.task import Task -from zeebepy.task.task_context import TaskContext +from pyzeebe.task.task import Task +from pyzeebe.task.task_context import TaskContext RANDOM_RANGE = 100000 diff --git a/zeebepy/decorators/__init__.py b/pyzeebe/decorators/__init__.py similarity index 100% rename from zeebepy/decorators/__init__.py rename to pyzeebe/decorators/__init__.py diff --git a/zeebepy/decorators/zeebe_decorator_base.py b/pyzeebe/decorators/zeebe_decorator_base.py similarity index 89% rename from zeebepy/decorators/zeebe_decorator_base.py rename to pyzeebe/decorators/zeebe_decorator_base.py index 7fe625a6..3cd39ce7 100644 --- a/zeebepy/decorators/zeebe_decorator_base.py +++ b/pyzeebe/decorators/zeebe_decorator_base.py @@ -1,6 +1,6 @@ from typing import List -from zeebepy.task.task_decorator import TaskDecorator +from pyzeebe.task.task_decorator import TaskDecorator class ZeebeDecoratorBase(object): diff --git a/zeebepy/decorators/zeebe_decorator_base_test.py b/pyzeebe/decorators/zeebe_decorator_base_test.py similarity index 91% rename from zeebepy/decorators/zeebe_decorator_base_test.py rename to pyzeebe/decorators/zeebe_decorator_base_test.py index a2b006f3..f7bda125 100644 --- a/zeebepy/decorators/zeebe_decorator_base_test.py +++ b/pyzeebe/decorators/zeebe_decorator_base_test.py @@ -1,5 +1,5 @@ -from zeebepy.common.random_utils import random_task_context -from zeebepy.decorators.zeebe_decorator_base import ZeebeDecoratorBase +from pyzeebe.common.random_utils import random_task_context +from pyzeebe.decorators.zeebe_decorator_base import ZeebeDecoratorBase def test_add_before(): diff --git a/zeebepy/grpc_internals/__init__.py b/pyzeebe/grpc_internals/__init__.py similarity index 100% rename from zeebepy/grpc_internals/__init__.py rename to pyzeebe/grpc_internals/__init__.py diff --git a/zeebepy/grpc_internals/zeebe_adapter.py b/pyzeebe/grpc_internals/zeebe_adapter.py similarity index 97% rename from zeebepy/grpc_internals/zeebe_adapter.py rename to pyzeebe/grpc_internals/zeebe_adapter.py index 39269b63..2a0944e7 100644 --- a/zeebepy/grpc_internals/zeebe_adapter.py +++ b/pyzeebe/grpc_internals/zeebe_adapter.py @@ -4,9 +4,9 @@ import grpc -from zeebepy.grpc_internals.zeebe_pb2 import * -from zeebepy.grpc_internals.zeebe_pb2_grpc import GatewayStub -from zeebepy.task.task_context import TaskContext +from pyzeebe.grpc_internals.zeebe_pb2 import * +from pyzeebe.grpc_internals.zeebe_pb2_grpc import GatewayStub +from pyzeebe.task.task_context import TaskContext class ZeebeAdapter: diff --git a/zeebepy/grpc_internals/zeebe_adapter_test.py b/pyzeebe/grpc_internals/zeebe_adapter_test.py similarity index 93% rename from zeebepy/grpc_internals/zeebe_adapter_test.py rename to pyzeebe/grpc_internals/zeebe_adapter_test.py index b7a9cb04..8550daa0 100644 --- a/zeebepy/grpc_internals/zeebe_adapter_test.py +++ b/pyzeebe/grpc_internals/zeebe_adapter_test.py @@ -5,10 +5,10 @@ import grpc import pytest -from zeebepy.common.random_utils import RANDOM_RANGE -from zeebepy.grpc_internals.zeebe_adapter import ZeebeAdapter -from zeebepy.grpc_internals.zeebe_pb2 import * -from zeebepy.grpc_internals.zeebe_pb2_grpc import GatewayServicer +from pyzeebe.common.random_utils import RANDOM_RANGE +from pyzeebe.grpc_internals.zeebe_adapter import ZeebeAdapter +from pyzeebe.grpc_internals.zeebe_pb2 import * +from pyzeebe.grpc_internals.zeebe_pb2_grpc import GatewayServicer zeebe_adapter: ZeebeAdapter @@ -62,7 +62,7 @@ def PublishMessage(self, request, context): @pytest.fixture(scope='module') def grpc_add_to_server(): - from zeebepy.grpc_internals.zeebe_pb2_grpc import add_GatewayServicer_to_server + from pyzeebe.grpc_internals.zeebe_pb2_grpc import add_GatewayServicer_to_server return add_GatewayServicer_to_server @@ -73,7 +73,7 @@ def grpc_servicer(): @pytest.fixture(scope='module') def grpc_stub_cls(grpc_channel): - from zeebepy.grpc_internals.zeebe_pb2_grpc import GatewayStub + from pyzeebe.grpc_internals.zeebe_pb2_grpc import GatewayStub return GatewayStub diff --git a/zeebepy/grpc_internals/zeebe_pb2.py b/pyzeebe/grpc_internals/zeebe_pb2.py similarity index 100% rename from zeebepy/grpc_internals/zeebe_pb2.py rename to pyzeebe/grpc_internals/zeebe_pb2.py diff --git a/zeebepy/grpc_internals/zeebe_pb2_grpc.py b/pyzeebe/grpc_internals/zeebe_pb2_grpc.py similarity index 99% rename from zeebepy/grpc_internals/zeebe_pb2_grpc.py rename to pyzeebe/grpc_internals/zeebe_pb2_grpc.py index 388b4996..00455781 100644 --- a/zeebepy/grpc_internals/zeebe_pb2_grpc.py +++ b/pyzeebe/grpc_internals/zeebe_pb2_grpc.py @@ -2,7 +2,7 @@ """Client and server classes corresponding to protobuf-defined services.""" import grpc -import zeebepy.grpc_internals.zeebe_pb2 as zeebe__pb2 +import pyzeebe.grpc_internals.zeebe_pb2 as zeebe__pb2 class GatewayStub(object): diff --git a/zeebepy/task/__init__.py b/pyzeebe/task/__init__.py similarity index 100% rename from zeebepy/task/__init__.py rename to pyzeebe/task/__init__.py diff --git a/zeebepy/task/task.py b/pyzeebe/task/task.py similarity index 82% rename from zeebepy/task/task.py rename to pyzeebe/task/task.py index bfbb071b..89878b39 100644 --- a/zeebepy/task/task.py +++ b/pyzeebe/task/task.py @@ -1,8 +1,8 @@ from typing import Callable, List, Dict -from zeebepy.decorators.zeebe_decorator_base import ZeebeDecoratorBase -from zeebepy.task.task_context import TaskContext -from zeebepy.task.task_status_controller import TaskStatusController +from pyzeebe.decorators.zeebe_decorator_base import ZeebeDecoratorBase +from pyzeebe.task.task_context import TaskContext +from pyzeebe.task.task_status_controller import TaskStatusController # TODO: Add support for async tasks diff --git a/zeebepy/task/task_context.py b/pyzeebe/task/task_context.py similarity index 100% rename from zeebepy/task/task_context.py rename to pyzeebe/task/task_context.py diff --git a/zeebepy/task/task_decorator.py b/pyzeebe/task/task_decorator.py similarity index 62% rename from zeebepy/task/task_decorator.py rename to pyzeebe/task/task_decorator.py index db1af516..ff895b50 100644 --- a/zeebepy/task/task_decorator.py +++ b/pyzeebe/task/task_decorator.py @@ -1,5 +1,5 @@ from typing import Callable -from zeebepy.task.task_context import TaskContext +from pyzeebe.task.task_context import TaskContext TaskDecorator = Callable[[TaskContext], TaskContext] diff --git a/zeebepy/task/task_status_controller.py b/pyzeebe/task/task_status_controller.py similarity index 83% rename from zeebepy/task/task_status_controller.py rename to pyzeebe/task/task_status_controller.py index 707e69ca..2c8b7a0a 100644 --- a/zeebepy/task/task_status_controller.py +++ b/pyzeebe/task/task_status_controller.py @@ -1,5 +1,5 @@ -from zeebepy.grpc_internals.zeebe_adapter import ZeebeAdapter -from zeebepy.task.task_context import TaskContext +from pyzeebe.grpc_internals.zeebe_adapter import ZeebeAdapter +from pyzeebe.task.task_context import TaskContext class TaskStatusController: diff --git a/zeebepy/task/task_status_controller_test.py b/pyzeebe/task/task_status_controller_test.py similarity index 77% rename from zeebepy/task/task_status_controller_test.py rename to pyzeebe/task/task_status_controller_test.py index b09bc6b3..613972ab 100644 --- a/zeebepy/task/task_status_controller_test.py +++ b/pyzeebe/task/task_status_controller_test.py @@ -3,9 +3,9 @@ import pytest -from zeebepy.common.random_utils import random_task_context -from zeebepy.grpc_internals.zeebe_adapter import ZeebeAdapter -from zeebepy.task.task_status_controller import TaskStatusController +from pyzeebe.common.random_utils import random_task_context +from pyzeebe.grpc_internals.zeebe_adapter import ZeebeAdapter +from pyzeebe.task.task_status_controller import TaskStatusController task_status_controller: TaskStatusController @@ -20,14 +20,14 @@ def run_around_tests(): def test_success(): - with patch('zeebepy.grpc_internals.zeebe_adapter.ZeebeAdapter.complete_job') as complete_job_mock: + with patch('pyzeebe.grpc_internals.zeebe_adapter.ZeebeAdapter.complete_job') as complete_job_mock: task_status_controller.success() complete_job_mock.assert_called_with(job_key=task_status_controller.context.key, variables=task_status_controller.context.variables) def test_error(): - with patch('zeebepy.grpc_internals.zeebe_adapter.ZeebeAdapter.throw_error') as throw_error_mock: + with patch('pyzeebe.grpc_internals.zeebe_adapter.ZeebeAdapter.throw_error') as throw_error_mock: message = str(uuid4()) task_status_controller.error(message) throw_error_mock.assert_called_with(job_key=task_status_controller.context.key, @@ -35,7 +35,7 @@ def test_error(): def test_failure(): - with patch('zeebepy.grpc_internals.zeebe_adapter.ZeebeAdapter.fail_job') as fail_job_mock: + with patch('pyzeebe.grpc_internals.zeebe_adapter.ZeebeAdapter.fail_job') as fail_job_mock: message = str(uuid4()) task_status_controller.failure(message) fail_job_mock.assert_called_with(job_key=task_status_controller.context.key, diff --git a/zeebepy/task/task_test.py b/pyzeebe/task/task_test.py similarity index 97% rename from zeebepy/task/task_test.py rename to pyzeebe/task/task_test.py index 3267bfbc..a3a7a6f1 100644 --- a/zeebepy/task/task_test.py +++ b/pyzeebe/task/task_test.py @@ -1,6 +1,6 @@ import uuid -from zeebepy.task.task import Task +from pyzeebe.task.task import Task def test_add_before(): diff --git a/zeebepy/worker/__init__.py b/pyzeebe/worker/__init__.py similarity index 100% rename from zeebepy/worker/__init__.py rename to pyzeebe/worker/__init__.py diff --git a/zeebepy/worker/worker.py b/pyzeebe/worker/worker.py similarity index 92% rename from zeebepy/worker/worker.py rename to pyzeebe/worker/worker.py index bda8be14..617d06b9 100644 --- a/zeebepy/worker/worker.py +++ b/pyzeebe/worker/worker.py @@ -2,13 +2,13 @@ from concurrent.futures import ThreadPoolExecutor from typing import List, Callable, Generator, Dict, Tuple -from zeebepy.common.exceptions import TaskNotFoundException, NotEnoughTasksException -from zeebepy.decorators.zeebe_decorator_base import ZeebeDecoratorBase -from zeebepy.grpc_internals.zeebe_adapter import ZeebeAdapter -from zeebepy.task.task import Task -from zeebepy.task.task_context import TaskContext -from zeebepy.task.task_decorator import TaskDecorator -from zeebepy.task.task_status_controller import TaskStatusController +from pyzeebe.common.exceptions import TaskNotFoundException, NotEnoughTasksException +from pyzeebe.decorators.zeebe_decorator_base import ZeebeDecoratorBase +from pyzeebe.grpc_internals.zeebe_adapter import ZeebeAdapter +from pyzeebe.task.task import Task +from pyzeebe.task.task_context import TaskContext +from pyzeebe.task.task_decorator import TaskDecorator +from pyzeebe.task.task_status_controller import TaskStatusController # TODO: Add support for async tasks diff --git a/zeebepy/worker/worker_test.py b/pyzeebe/worker/worker_test.py similarity index 85% rename from zeebepy/worker/worker_test.py rename to pyzeebe/worker/worker_test.py index 367c4493..9baf1263 100644 --- a/zeebepy/worker/worker_test.py +++ b/pyzeebe/worker/worker_test.py @@ -4,11 +4,11 @@ import pytest -from zeebepy.common.exceptions import TaskNotFoundException, NotEnoughTasksException -from zeebepy.common.random_utils import random_task_context -from zeebepy.task.task import Task -from zeebepy.task.task_context import TaskContext -from zeebepy.worker.worker import ZeebeWorker +from pyzeebe.common.exceptions import TaskNotFoundException, NotEnoughTasksException +from pyzeebe.common.random_utils import random_task_context +from pyzeebe.task.task import Task +from pyzeebe.task.task_context import TaskContext +from pyzeebe.worker.worker import ZeebeWorker zeebe_worker: ZeebeWorker task: Task @@ -39,13 +39,13 @@ def test_add_task(): assert callable(task.handler) context = random_task_context(task) context.variables = {'x': str(uuid4())} - with patch('zeebepy.grpc_internals.zeebe_adapter.ZeebeAdapter.complete_job') as mock: + with patch('pyzeebe.grpc_internals.zeebe_adapter.ZeebeAdapter.complete_job') as mock: assert isinstance(task.handler(context), dict) mock.assert_called_with(job_key=context.key, variables=context.variables) def test_before_task_decorator_called(): - with patch('zeebepy.worker.worker_test.decorator') as mock: + with patch('pyzeebe.worker.worker_test.decorator') as mock: context = random_task_context(task) context.variables = {'x': str(uuid4())} @@ -53,14 +53,14 @@ def test_before_task_decorator_called(): task.before(decorator) zeebe_worker.add_task(task) - with patch('zeebepy.grpc_internals.zeebe_adapter.ZeebeAdapter.complete_job') as grpc_mock: + with patch('pyzeebe.grpc_internals.zeebe_adapter.ZeebeAdapter.complete_job') as grpc_mock: assert isinstance(task.handler(context), dict) grpc_mock.assert_called_with(job_key=context.key, variables=context.variables) mock.assert_called_with(context) def test_after_task_decorator_called(): - with patch('zeebepy.worker.worker_test.decorator') as mock: + with patch('pyzeebe.worker.worker_test.decorator') as mock: context = random_task_context(task) context.variables = {'x': str(uuid4())} @@ -69,7 +69,7 @@ def test_after_task_decorator_called(): task.after(decorator) zeebe_worker.add_task(task) - with patch('zeebepy.grpc_internals.zeebe_adapter.ZeebeAdapter.complete_job') as grpc_mock: + with patch('pyzeebe.grpc_internals.zeebe_adapter.ZeebeAdapter.complete_job') as grpc_mock: assert isinstance(task.handler(context), dict) grpc_mock.assert_called_with(job_key=context.key, variables=context.variables) mock.assert_called_with(context) @@ -88,7 +88,7 @@ def exception_handler(e, context, status_setter): task.inner_function = task_handler task.exception_handler = exception_handler - with patch('zeebepy.worker.worker_test.task.exception_handler') as mock: + with patch('pyzeebe.worker.worker_test.task.exception_handler') as mock: zeebe_worker.add_task(task) task.handler(context) mock.assert_called() @@ -177,9 +177,9 @@ def test_create_before_decorator_runner(): def test_handle_one_job(): context = random_task_context(task) - with patch('zeebepy.worker.worker.ZeebeWorker._get_task_contexts') as get_jobs_mock: + with patch('pyzeebe.worker.worker.ZeebeWorker._get_task_contexts') as get_jobs_mock: get_jobs_mock.return_value = [context] - with patch('zeebepy.worker.worker_test.task.handler') as task_handler_mock: + with patch('pyzeebe.worker.worker_test.task.handler') as task_handler_mock: task_handler_mock.return_value = {'x': str(uuid4())} zeebe_worker._handle_task_contexts(task) task_handler_mock.assert_called_with(context) @@ -188,9 +188,9 @@ def test_handle_one_job(): def test_handle_no_job(): context = random_task_context(task) - with patch('zeebepy.worker.worker.ZeebeWorker._get_task_contexts') as get_jobs_mock: + with patch('pyzeebe.worker.worker.ZeebeWorker._get_task_contexts') as get_jobs_mock: get_jobs_mock.return_value = [] - with patch('zeebepy.worker.worker_test.task.handler') as task_handler_mock: + with patch('pyzeebe.worker.worker_test.task.handler') as task_handler_mock: task_handler_mock.return_value = {'x': str(uuid4())} zeebe_worker._handle_task_contexts(task) with pytest.raises(AssertionError): @@ -200,9 +200,9 @@ def test_handle_no_job(): def test_handle_many_jobs(): context = random_task_context(task) - with patch('zeebepy.worker.worker.ZeebeWorker._get_task_contexts') as get_jobs_mock: + with patch('pyzeebe.worker.worker.ZeebeWorker._get_task_contexts') as get_jobs_mock: get_jobs_mock.return_value = [context] - with patch('zeebepy.worker.worker_test.task.handler') as task_handler_mock: + with patch('pyzeebe.worker.worker_test.task.handler') as task_handler_mock: task_handler_mock.return_value = {'x': str(uuid4())} zeebe_worker._handle_task_contexts(task) task_handler_mock.assert_called_with(context) diff --git a/setup.py b/setup.py index 93155a31..68a99f1c 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ long_description = fh.read() setuptools.setup( - name="zeebepy", + name="pyzeebe", version="1.0.1", author="Jonatan Martens", author_email="jonatanmartenstav@gmail.com", diff --git a/zeebepy/__init__.py b/zeebepy/__init__.py deleted file mode 100644 index ef5c1859..00000000 --- a/zeebepy/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -from zeebepy.task.task import Task -from zeebepy.task.task_context import TaskContext -from zeebepy.task.task_status_controller import TaskStatusController -from zeebepy.worker.worker import ZeebeWorker From 059c5a6c024cf491039eab94094ed876c18a7c02 Mon Sep 17 00:00:00 2001 From: Jonatan Martens Date: Sun, 23 Aug 2020 12:30:31 +0300 Subject: [PATCH 2/2] Change version to 1.0.0 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 68a99f1c..772617a7 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="pyzeebe", - version="1.0.1", + version="1.0.0", author="Jonatan Martens", author_email="jonatanmartenstav@gmail.com", description="Zeebe client api",