diff tests/test-archive.t @ 45048:2c0043977b6d stable

archival: abort if compression method is unavailable `tarfile.CompressionError` is documented to be the "exception for unavailable compression methods". Also, make tests conditional on whether the lzma module is available or not.
author Manuel Jacob <me@manueljacob.de>
date Wed, 08 Jul 2020 08:57:21 +0200
parents 862025f108c7
children 8d72e29ad1e0
line wrap: on
line diff
--- a/tests/test-archive.t	Wed Jul 08 08:25:30 2020 +0200
+++ b/tests/test-archive.t	Wed Jul 08 08:57:21 2020 +0200
@@ -576,12 +576,18 @@
 
 test xz support only available in Python 3.4
 
-#if py3
+#if lzma
   $ hg archive ../archive.txz
   $ which xz >/dev/null && xz -l ../archive.txz | head -n1 || true
   Strms  Blocks   Compressed Uncompressed  Ratio  Check   Filename (xz !)
   $ rm -f ../archive.txz
-#else
+#endif
+#if py3 no-lzma
+  $ hg archive ../archive.txz
+  abort: lzma module is not available
+  [255]
+#endif
+#if no-py3
   $ hg archive ../archive.txz
   abort: xz compression is only available in Python 3
   [255]