Skip to content

Commit 215f52d

Browse files
committed
fix tests for windows
1 parent cd84d08 commit 215f52d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/test/java/dev/zarr/zarrjava/ZarrTest.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ public class ZarrTest {
4141
final static Path ZARRITA_READ_PATH = Paths.get("src/test/java/dev/zarr/zarrjava/zarrita_read.py");
4242
final static String CONDA_ENVIRONMENT = "zarrita_env";
4343

44+
public static String pythonPath() {
45+
if (System.getProperty("os.name").startsWith("Windows")) {
46+
return "venv_zarrita\\Scripts\\python.exe";
47+
}
48+
return "venv_zarrita/bin/python";
49+
}
50+
4451
@BeforeAll
4552
public static void clearTestoutputFolder() throws IOException {
4653
if (Files.exists(TESTOUTPUT)) {
@@ -55,7 +62,7 @@ public static void clearTestoutputFolder() throws IOException {
5562
@ValueSource(strings = {"blosc", "gzip", "zstd", "bytes", "transpose", "sharding", "crc32c"})
5663
public void testReadFromZarrita(String codec) throws IOException, ZarrException, InterruptedException {
5764

58-
String command = "venv_zarrita/bin/python";
65+
String command = pythonPath();
5966
ProcessBuilder pb = new ProcessBuilder(command, ZARRITA_WRITE_PATH.toString(), codec, TESTOUTPUT.toString());
6067
Process process = pb.start();
6168

@@ -131,7 +138,7 @@ public void testWriteToZarrita(String codec) throws IOException, ZarrException,
131138
Arrays.setAll(data, p -> p);
132139
array.write(ucar.ma2.Array.factory(ucar.ma2.DataType.UINT, new int[]{16, 16}, data));
133140

134-
String command = "venv_zarrita/bin/python";
141+
String command = pythonPath();
135142

136143
ProcessBuilder pb = new ProcessBuilder(command, ZARRITA_READ_PATH.toString(), codec, TESTOUTPUT.toString());
137144
Process process = pb.start();

0 commit comments

Comments
 (0)