Skip to content

Commit

Permalink
Use config_for_cluster_tests in sync fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
crusaderky committed Sep 11, 2023
1 parent 7744d68 commit 56b8f37
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
16 changes: 16 additions & 0 deletions distributed/tests/test_utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1091,3 +1091,19 @@ async def test_ensure_no_new_clients():
async with Client(s.address, asynchronous=True):
with ensure_no_new_clients():
pass


@pytest.mark.parametrize("nanny", [False, True])
def test_cluster_uses_config_for_test(nanny):
key = "distributed.admin.tick.interval"
local = dask.config.get(key)

with cluster(nanny=nanny, nworkers=1) as (scheduler, workers):
with Client(scheduler["address"]) as client:
s_remote = client.run_on_scheduler(dask.config.get, key)
assert s_remote != local

w_remote = client.run(dask.config.get, key)
w_remote = next(iter(w_remote.values()))
assert w_remote != local
assert w_remote == s_remote
6 changes: 3 additions & 3 deletions distributed/utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ async def _():


def run_worker(q, scheduler_q, config, **kwargs):
with dask.config.set(config):
with config_for_cluster_tests(**config):

Check warning on line 401 in distributed/utils_test.py

View check run for this annotation

Codecov / codecov/patch

distributed/utils_test.py#L401

Added line #L401 was not covered by tests
from distributed import Worker

reset_logger_locks()
Expand All @@ -422,7 +422,7 @@ async def _():

@log_errors
def run_nanny(q, scheduler_q, config, **kwargs):
with dask.config.set(config):
with config_for_cluster_tests(**config):

Check warning on line 425 in distributed/utils_test.py

View check run for this annotation

Codecov / codecov/patch

distributed/utils_test.py#L425

Added line #L425 was not covered by tests
scheduler_addr = scheduler_q.get()

async def _():
Expand Down Expand Up @@ -617,7 +617,7 @@ def cluster(

enable_proctitle_on_children()

with check_process_leak(check=True), check_instances(), config_for_cluster_tests():
with check_process_leak(check=True), check_instances():
if nanny:
_run_worker = run_nanny
else:
Expand Down

0 comments on commit 56b8f37

Please sign in to comment.