Skip to content

Commit 472aae6

Browse files
committed
Run workflow tests with different worker configs
1 parent 35b1a35 commit 472aae6

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

tests/helpers/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
UpdateMethodMultiParam,
2929
)
3030

31+
DEFAULT_WORKER_KWARGS = {}
32+
3133

3234
def new_worker(
3335
client: Client,
@@ -47,7 +49,7 @@ def new_worker(
4749
workflow_runner=workflow_runner,
4850
max_cached_workflows=max_cached_workflows,
4951
workflow_failure_exception_types=workflow_failure_exception_types,
50-
**kwargs,
52+
**(DEFAULT_WORKER_KWARGS | kwargs),
5153
)
5254

5355

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"""
2+
Run tests in test_workflow.py with different worker configurations.
3+
"""
4+
5+
import inspect
6+
7+
import pytest
8+
9+
import tests.helpers
10+
import tests.worker.test_workflow as test_workflow_module
11+
12+
_worker_configs = [
13+
pytest.param(
14+
{
15+
"max_concurrent_workflow_tasks": 2,
16+
"max_concurrent_workflow_task_polls": 2,
17+
},
18+
id="max_concurrent_workflow_tasks_2_polls_2",
19+
),
20+
]
21+
22+
23+
@pytest.fixture(scope="module", autouse=True, params=_worker_configs)
24+
def worker_config(request):
25+
original_kwargs = tests.helpers.DEFAULT_WORKER_KWARGS.copy()
26+
tests.helpers.DEFAULT_WORKER_KWARGS.update(request.param)
27+
yield
28+
tests.helpers.DEFAULT_WORKER_KWARGS.clear()
29+
tests.helpers.DEFAULT_WORKER_KWARGS.update(original_kwargs)
30+
31+
32+
for name, fn in inspect.getmembers(test_workflow_module, inspect.isfunction):
33+
if name.startswith("test_"):
34+
globals()[name] = fn

0 commit comments

Comments
 (0)