Skip to content

Commit 665c68c

Browse files
committed
Avoid one more atexit in copy tests.
1 parent 66f6344 commit 665c68c

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

‎zarr/tests/test_convenience.py‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import atexit
2-
import os
32
import tempfile
43
import unittest
54
from numbers import Integral
@@ -683,17 +682,16 @@ def test_copy_group_dry_run(self, source, dest):
683682
assert 0 == n_bytes_copied
684683
assert_array_equal(baz, dest['foo/bar/baz'])
685684

686-
def test_logging(self, source, dest):
685+
def test_logging(self, source, dest, tmpdir):
687686
# callable log
688687
copy(source['foo'], dest, dry_run=True, log=print)
689688

690689
# file name
691-
fn = tempfile.mktemp()
692-
atexit.register(os.remove, fn)
690+
fn = str(tmpdir.join('log_name'))
693691
copy(source['foo'], dest, dry_run=True, log=fn)
694692

695693
# file
696-
with tempfile.TemporaryFile(mode='w') as f:
694+
with tmpdir.join('log_file').open(mode='w') as f:
697695
copy(source['foo'], dest, dry_run=True, log=f)
698696

699697
# bad option

0 commit comments

Comments
 (0)