|
3 | 3 | from uuid import uuid4 |
4 | 4 |
|
5 | 5 | from pycpio import PyCPIO |
| 6 | +from pycpio.errors import UnavailableCompression |
6 | 7 | from zenlib.logging import loggify |
7 | 8 |
|
8 | 9 |
|
@@ -55,23 +56,26 @@ def make_test_files(self, count, subdir=None, data=None): |
55 | 56 |
|
56 | 57 | def test_write_no_compress(self): |
57 | 58 | self.make_test_files(100) |
58 | | - self.cpio.append_cpio(self.workdir.name) |
| 59 | + self.cpio.append_recursive(self.workdir.name) |
59 | 60 | out_file = NamedTemporaryFile() # Out file for the cpio |
60 | 61 | self.cpio.write_cpio_file(out_file.file.name) |
61 | 62 | out_file.file.flush() |
62 | 63 |
|
63 | 64 | def test_write_xz_compress(self): |
64 | 65 | self.make_test_files(100) |
65 | | - self.cpio.append_cpio(self.workdir.name) |
| 66 | + self.cpio.append_recursive(self.workdir.name) |
66 | 67 | out_file = NamedTemporaryFile() |
67 | | - self.cpio.write_cpio_file(out_file.file.name, compress="xz") |
| 68 | + self.cpio.write_cpio_file(out_file.file.name, compression="xz") |
68 | 69 | out_file.file.flush() |
69 | 70 |
|
70 | 71 | def test_write_zstd_compress(self): |
71 | 72 | self.make_test_files(100) |
72 | | - self.cpio.append_cpio(self.workdir.name) |
| 73 | + self.cpio.append_recursive(self.workdir.name) |
73 | 74 | out_file = NamedTemporaryFile() |
74 | | - self.cpio.write_cpio_file(out_file.file.name, compress="zstd") |
| 75 | + try: |
| 76 | + self.cpio.write_cpio_file(out_file.file.name, compression="zstd") |
| 77 | + except UnavailableCompression as e: |
| 78 | + self.skipTest(f"Zstandard compression is not available in this environment: {e}") |
75 | 79 | out_file.file.flush() |
76 | 80 |
|
77 | 81 |
|
|
0 commit comments