Skip to content

Commit

Permalink
Drop redundant geninc (#6740)
Browse files Browse the repository at this point in the history
  • Loading branch information
hendrikmakait authored Jul 18, 2022
1 parent 04421e4 commit 72995a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
13 changes: 6 additions & 7 deletions distributed/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
double,
gen_cluster,
gen_test,
geninc,
get_cert,
inc,
map_varying,
Expand Down Expand Up @@ -2662,13 +2661,13 @@ def func(x, y=10):

@gen_cluster(client=True)
async def test_run_coroutine(c, s, a, b):
results = await c.run(geninc, 1, delay=0.05)
results = await c.run(asyncinc, 1, delay=0.05)
assert results == {a.address: 2, b.address: 2}

results = await c.run(geninc, 1, delay=0.05, workers=[a.address])
results = await c.run(asyncinc, 1, delay=0.05, workers=[a.address])
assert results == {a.address: 2}

results = await c.run(geninc, 1, workers=[])
results = await c.run(asyncinc, 1, workers=[])
assert results == {}

with pytest.raises(RuntimeError, match="hello"):
Expand All @@ -2679,14 +2678,14 @@ async def test_run_coroutine(c, s, a, b):


def test_run_coroutine_sync(c, s, a, b):
result = c.run(geninc, 2, delay=0.01)
result = c.run(asyncinc, 2, delay=0.01)
assert result == {a["address"]: 3, b["address"]: 3}

result = c.run(geninc, 2, workers=[a["address"]])
result = c.run(asyncinc, 2, workers=[a["address"]])
assert result == {a["address"]: 3}

t1 = time()
result = c.run(geninc, 2, delay=10, wait=False)
result = c.run(asyncinc, 2, delay=10, wait=False)
t2 = time()
assert result is None
assert t2 - t1 <= 1.0
Expand Down
5 changes: 0 additions & 5 deletions distributed/utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,11 +430,6 @@ def apply(func, *args, **kwargs):
return apply, list(map(varying, itemslists))


async def geninc(x, delay=0.02):
await asyncio.sleep(delay)
return x + 1


async def asyncinc(x, delay=0.02):
await asyncio.sleep(delay)
return x + 1
Expand Down

0 comments on commit 72995a8

Please sign in to comment.