8000 Avoid one more atexit in copy tests. · zarr-developers/zarr-python@ff154ba · GitHub
[go: up one dir, main page]

Skip to content 10000

Commit ff154ba

Browse files
committed
Avoid one more atexit in copy tests.
1 parent 449aece commit ff154ba

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

zarr/tests/test_convenience.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from __future__ import absolute_import, print_function, division
33
import tempfile
44
import atexit
5-
import os
65
import unittest
76
from numbers import Integral
87

@@ -601,17 +600,16 @@ def test_copy_group_dry_run(self, source, dest):
601600
assert 0 == n_bytes_copied
602601
assert_array_equal(baz, dest['foo/bar/baz'])
603602

604-
def test_logging(self, source, dest):
603+
def test_logging(self, source, dest, tmpdir):
605604
# callable log
606605
copy(source['foo'], dest, dry_run=True, log=print)
607606

608607
# file name
609-
fn = tempfile.mktemp()
610-
atexit.register(os.remove, fn)
608+
fn = str(tmpdir.join('log_name'))
611609
copy(source['foo'], dest, dry_run=True, log=fn)
612610

613611
# file
614-
with tempfile.TemporaryFile(mode='w') as f:
612+
with tmpdir.join('log_file').open(mode='w') as f:
615613
copy(source['foo'], dest, dry_run=True, log=f)
616614

617615
# bad option

0 commit comments

Comments
 (0)
0