Skip to content
This repository was archived by the owner on Feb 8, 2023. It is now read-only.

Commit dcfe896

Browse files
Fix
1 parent 48b8b57 commit dcfe896

File tree

1 file changed

+29
-24
lines changed

1 file changed

+29
-24
lines changed

mars/oscar/backends/mars/tests/test_transfer.py

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
import os
16+
import shutil
1617
import sys
1718
import tempfile
1819
from typing import List
@@ -202,27 +203,31 @@ async def test_copy_via_fileobjects():
202203
subprocess_start_method=start_method,
203204
)
204205

205-
with tempfile.TemporaryDirectory() as d:
206-
async with pool:
207-
ctx = get_context()
208-
209-
# actor on main pool
210-
actor_ref1 = await ctx.create_actor(
211-
FileobjTransferActor,
212-
uid="test-1",
213-
address=pool.external_address,
214-
allocate_strategy=ProcessIndex(1),
215-
)
216-
actor_ref2 = await ctx.create_actor(
217-
FileobjTransferActor,
218-
uid="test-2",
219-
address=pool.external_address,
220-
allocate_strategy=ProcessIndex(2),
221-
)
222-
sizes = [10 * 1024**2, 3 * 1024**2]
223-
names = []
224-
for _ in range(2 * len(sizes)):
225-
_, p = tempfile.mkstemp(dir=d)
226-
names.append(p)
227-
228-
await actor_ref1.copy_data(actor_ref2, names[::2], names[1::2], sizes=sizes)
206+
d = tempfile.mkdtemp()
207+
async with pool:
208+
ctx = get_context()
209+
210+
# actor on main pool
211+
actor_ref1 = await ctx.create_actor(
212+
FileobjTransferActor,
213+
uid="test-1",
214+
address=pool.external_address,
215+
allocate_strategy=ProcessIndex(1),
216+
)
217+
actor_ref2 = await ctx.create_actor(
218+
FileobjTransferActor,
219+
uid="test-2",
220+
address=pool.external_address,
221+
allocate_strategy=ProcessIndex(2),
222+
)
223+
sizes = [10 * 1024**2, 3 * 1024**2]
224+
names = []
225+
for _ in range(2 * len(sizes)):
226+
_, p = tempfile.mkstemp(dir=d)
227+
names.append(p)
228+
229+
await actor_ref1.copy_data(actor_ref2, names[::2], names[1::2], sizes=sizes)
230+
try:
231+
shutil.rmtree(d)
232+
except PermissionError:
233+
pass

0 commit comments

Comments
 (0)