Files
hatchet/sdks/python/conftest.py
matt 6c29e48204 Feat: Dynamic worker label assign (#3137)
* feat: initial wiring work on desired labels

* feat: initial wiring

* chore: gen python

* fix: use the whole desired label thing instead

* fix: more wiring, improve types

* fix: sql type

* fix: len check

* chore: gen python

* fix: initial plural label work

* fix: store the labels properly on the task

* fix: skip cache on override

* fix: bug

* fix: scoping bug whoops

* chore: lint

* fix: send labels back over the api correctly

* feat: python test

* fix: lint

* fix: comment

* fix: override

* fix: namespaces, ugh

* fix: no need for error here

* chore: version

* feat: ruby, go, ts

* feat: versions

* fix: appease the rubocop

* chore: lint

* chore: bundle install

* fix: tests

* chore: lint

* chore: lint more

* fix: ts test

* fix: rb

* chore: gen

* chore: reset gemfile

* chore: reset changelog

* fix: pgroup

* fix: tests, part i

* Revert "chore: reset changelog"

This reverts commit b63bf7d3e5.

* Revert "chore: reset gemfile"

This reverts commit bb848bb6f0.

* fix: go -> golang mapping hack

* fix: go enums

* fix: appease the cop

* fix: namespace

* chore: gen
2026-03-04 11:03:58 -05:00

40 lines
1.0 KiB
Python

from collections.abc import AsyncGenerator, Generator
from subprocess import Popen
from typing import cast
import pytest
import pytest_asyncio
from pytest import FixtureRequest
from hatchet_sdk import Hatchet
from tests.worker_fixture import hatchet_worker
@pytest_asyncio.fixture(scope="session", loop_scope="session")
async def hatchet() -> AsyncGenerator[Hatchet, None]:
yield Hatchet(
debug=True,
)
@pytest.fixture(scope="session", autouse=True)
def worker() -> Generator[Popen[bytes], None, None]:
command = ["poetry", "run", "python", "examples/worker.py"]
with hatchet_worker(command) as proc:
yield proc
def _on_demand_worker_fixture(
request: FixtureRequest,
) -> Generator[Popen[bytes], None, None]:
command, port = cast(tuple[list[str], int], request.param)
with hatchet_worker(command, port) as proc:
yield proc
@pytest.fixture(scope="session")
def on_demand_worker(request: FixtureRequest) -> Generator[Popen[bytes], None, None]:
yield from _on_demand_worker_fixture(request)