Skip to content

Commit

Permalink
Make integration test fixtures module scoped
Browse files Browse the repository at this point in the history
This way unit tests will not use them
  • Loading branch information
JonatanMartens committed Jul 21, 2021
1 parent ef78b16 commit b8cbf15
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/integration/integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,29 @@
from pyzeebe.errors import ProcessDefinitionNotFoundError


@pytest.fixture(scope="session")
@pytest.fixture(scope="module")
def event_loop():
loop = asyncio.new_event_loop()
yield loop
loop.close()


@pytest.fixture(scope="session")
@pytest.fixture(scope="module")
def grpc_channel():
return create_insecure_channel()


@pytest.fixture(scope="session")
@pytest.fixture(scope="module")
def zeebe_client(grpc_channel: grpc.aio.Channel):
return ZeebeClient(grpc_channel)


@pytest.fixture(scope="session")
@pytest.fixture(scope="module")
def zeebe_worker(grpc_channel):
return ZeebeWorker(grpc_channel)


@pytest.fixture(autouse=True, scope="session")
@pytest.fixture(autouse=True, scope="module")
def task(zeebe_worker: ZeebeWorker):
def exception_handler(exc: Exception, job: Job) -> None:
job.set_error_status(f"Failed to run task {job.type}. Reason: {exc}")
Expand All @@ -46,7 +46,7 @@ async def task_handler(should_throw: bool, input: str) -> Dict:


@pytest.mark.asyncio
@pytest.fixture(autouse=True, scope="session")
@pytest.fixture(autouse=True, scope="module")
async def deploy_process(zeebe_client: ZeebeClient):
try:
integration_tests_path = os.path.join("tests", "integration")
Expand All @@ -57,7 +57,7 @@ async def deploy_process(zeebe_client: ZeebeClient):
await zeebe_client.deploy_process("test.bpmn")


@pytest.fixture(autouse=True, scope="session")
@pytest.fixture(autouse=True, scope="module")
def start_worker(event_loop: asyncio.AbstractEventLoop, zeebe_worker: ZeebeWorker):
event_loop.create_task(zeebe_worker.work())
yield
Expand Down

0 comments on commit b8cbf15

Please sign in to comment.