Skip to content

Commit 48bf3f7

Browse files
Fix stupid du test
Closes #330
1 parent bcd0f74 commit 48bf3f7

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

tests/test_core.py

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import subprocess
12
import sys
23

34
import numpy as np
@@ -231,16 +232,14 @@ def test_examples(self, chunk_size, size, start, stop):
231232

232233
@pytest.mark.skipif(sys.platform != "linux", reason="Only valid on Linux")
233234
@pytest.mark.parametrize(
234-
("path", "expected"),
235+
"path",
235236
[
236-
# NOTE: this data is generated using du -sb on a Linux system.
237-
# It works in CI on Linux, but it'll probably break at some point.
238-
# It's also necessary to update these numbers each time a new data
239-
# file gets added
240-
("tests/data", 4983044),
241-
("tests/data/vcf", 4970907),
242-
("tests/data/vcf/sample.vcf.gz", 1089),
237+
"tests/data",
238+
"tests/data/vcf",
239+
"tests/data/vcf/sample.vcf.gz",
243240
],
244241
)
245-
def test_du(path, expected):
246-
assert core.du(path) == expected
242+
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

0 commit comments

Comments
 (0)