comparison 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
comparison
equal deleted inserted replaced
45047:40120de810ba 45048:2c0043977b6d
574 *172*80*00:00*old/.hg_archival.txt (glob) 574 *172*80*00:00*old/.hg_archival.txt (glob)
575 *0*80*00:00*old/old (glob) 575 *0*80*00:00*old/old (glob)
576 576
577 test xz support only available in Python 3.4 577 test xz support only available in Python 3.4
578 578
579 #if py3 579 #if lzma
580 $ hg archive ../archive.txz 580 $ hg archive ../archive.txz
581 $ which xz >/dev/null && xz -l ../archive.txz | head -n1 || true 581 $ which xz >/dev/null && xz -l ../archive.txz | head -n1 || true
582 Strms Blocks Compressed Uncompressed Ratio Check Filename (xz !) 582 Strms Blocks Compressed Uncompressed Ratio Check Filename (xz !)
583 $ rm -f ../archive.txz 583 $ rm -f ../archive.txz
584 #else 584 #endif
585 #if py3 no-lzma
586 $ hg archive ../archive.txz
587 abort: lzma module is not available
588 [255]
589 #endif
590 #if no-py3
585 $ hg archive ../archive.txz 591 $ hg archive ../archive.txz
586 abort: xz compression is only available in Python 3 592 abort: xz compression is only available in Python 3
587 [255] 593 [255]
588 #endif 594 #endif
589 595