Skip to content

Commit 46de3af

Browse files
Copy directory tree to /tmp
1 parent 48bf3f7 commit 46de3af

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tests/test_core.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
import pathlib
12
import subprocess
23
import sys
4+
import tempfile
35

46
import numpy as np
57
import pytest
@@ -240,6 +242,11 @@ def test_examples(self, chunk_size, size, start, stop):
240242
],
241243
)
242244
def test_du(path):
243-
s = subprocess.check_output(["du", "-sb", "--apparent-size", str(path)]).decode()
244-
value = int(s.split()[0])
245-
assert core.du(path) == value
245+
with tempfile.TemporaryDirectory() as tmp_dir:
246+
subprocess.check_call(["cp", "-pR", "tests", tmp_dir])
247+
copy_path = pathlib.Path(tmp_dir) / path
248+
s = subprocess.check_output(
249+
["du", "-sb", "--apparent-size", str(copy_path)]
250+
).decode()
251+
value = int(s.split()[0])
252+
assert core.du(path) == value

0 commit comments

Comments
 (0)