diff tests/hghave.py @ 44842: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 51ffb2a6c08a
children 3a6ec080b521
line wrap: on
line diff
--- a/tests/hghave.py	Wed Jul 08 08:25:30 2020 +0200
+++ b/tests/hghave.py	Wed Jul 08 08:57:21 2020 +0200
@@ -1074,3 +1074,14 @@
     return matchoutput(
         '`rustup which --toolchain nightly rustfmt` --version', b'rustfmt'
     )
+
+
+@check("lzma", "python lzma module")
+def has_lzma():
+    try:
+        import _lzma
+
+        _lzma.FORMAT_XZ
+        return True
+    except ImportError:
+        return False