Skip to content

Commit 97359f7

Browse files
committed
test updateS
1 parent 7d85c76 commit 97359f7

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

tests/durabletask/test_concurrency_options.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33

44
import os
55

6-
from durabletask.worker import ConcurrencyOptions, TaskHubGrpcWorker
6+
from durabletask import worker
77

88

99
def test_default_concurrency_options():
1010
"""Test that default concurrency options work correctly."""
11-
options = ConcurrencyOptions()
11+
options = worker.ConcurrencyOptions()
1212
processor_count = os.cpu_count() or 1
1313
expected_default = 100 * processor_count
1414
expected_workers = processor_count + 4
@@ -20,7 +20,7 @@ def test_default_concurrency_options():
2020

2121
def test_custom_concurrency_options():
2222
"""Test that custom concurrency options work correctly."""
23-
options = ConcurrencyOptions(
23+
options = worker.ConcurrencyOptions(
2424
maximum_concurrent_activity_work_items=50,
2525
maximum_concurrent_orchestration_work_items=25,
2626
maximum_thread_pool_workers=30,
@@ -37,7 +37,7 @@ def test_partial_custom_options():
3737
expected_default = 100 * processor_count
3838
expected_workers = processor_count + 4
3939

40-
options = ConcurrencyOptions(
40+
options = worker.ConcurrencyOptions(
4141
maximum_concurrent_activity_work_items=30
4242
)
4343

@@ -46,47 +46,46 @@ def test_partial_custom_options():
4646
assert options.maximum_thread_pool_workers == expected_workers
4747

4848

49-
5049
def test_worker_with_concurrency_options():
5150
"""Test that TaskHubGrpcWorker accepts concurrency options."""
52-
options = ConcurrencyOptions(
51+
options = worker.ConcurrencyOptions(
5352
maximum_concurrent_activity_work_items=10,
5453
maximum_concurrent_orchestration_work_items=20,
5554
maximum_thread_pool_workers=15,
5655
)
5756

58-
worker = TaskHubGrpcWorker(concurrency_options=options)
57+
grpc_worker = worker.TaskHubGrpcWorker(concurrency_options=options)
5958

60-
assert worker.concurrency_options == options
59+
assert grpc_worker.concurrency_options == options
6160

6261

6362
def test_worker_default_options():
6463
"""Test that TaskHubGrpcWorker uses default options when no parameters are provided."""
65-
worker = TaskHubGrpcWorker()
64+
grpc_worker = worker.TaskHubGrpcWorker()
6665

6766
processor_count = os.cpu_count() or 1
6867
expected_default = 100 * processor_count
6968
expected_workers = processor_count + 4
7069

7170
assert (
72-
worker.concurrency_options.maximum_concurrent_activity_work_items == expected_default
71+
grpc_worker.concurrency_options.maximum_concurrent_activity_work_items == expected_default
7372
)
7473
assert (
75-
worker.concurrency_options.maximum_concurrent_orchestration_work_items == expected_default
74+
grpc_worker.concurrency_options.maximum_concurrent_orchestration_work_items == expected_default
7675
)
77-
assert worker.concurrency_options.maximum_thread_pool_workers == expected_workers
76+
assert grpc_worker.concurrency_options.maximum_thread_pool_workers == expected_workers
7877

7978

8079
def test_concurrency_options_property_access():
8180
"""Test that the concurrency_options property works correctly."""
82-
options = ConcurrencyOptions(
81+
options = worker.ConcurrencyOptions(
8382
maximum_concurrent_activity_work_items=15,
8483
maximum_concurrent_orchestration_work_items=25,
8584
maximum_thread_pool_workers=30,
8685
)
8786

88-
worker = TaskHubGrpcWorker(concurrency_options=options)
89-
retrieved_options = worker.concurrency_options
87+
grpc_worker = worker.TaskHubGrpcWorker(concurrency_options=options)
88+
retrieved_options = grpc_worker.concurrency_options
9089

9190
# Should be the same object
9291
assert retrieved_options is options
@@ -95,4 +94,3 @@ def test_concurrency_options_property_access():
9594
assert retrieved_options.maximum_concurrent_activity_work_items == 15
9695
assert retrieved_options.maximum_concurrent_orchestration_work_items == 25
9796
assert retrieved_options.maximum_thread_pool_workers == 30
98-

0 commit comments

Comments
 (0)