From 5e046df615fead06e081234f432900146523f645 Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Wed, 26 Aug 2020 21:19:37 +0200 Subject: tests: Properly skip test_openpgp.py::test_cli when no gpg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- tests/test_openpgp.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/test_openpgp.py b/tests/test_openpgp.py index 7489a96..0037f41 100644 --- a/tests/test_openpgp.py +++ b/tests/test_openpgp.py @@ -442,14 +442,17 @@ def test_cli(tmp_path, caplog, manifest_var, key_var, expected): with open(tmp_path / 'metadata.xml', 'wb'): pass - eexit = 0 if expected is None else 1 - assert eexit == gemato.cli.main(['gemato', 'verify', - '--openpgp-key', - str(tmp_path / '.key.bin'), - '--no-refresh-keys', - '--require-signed-manifest', - str(tmp_path)]) + retval = gemato.cli.main(['gemato', 'verify', + '--openpgp-key', + str(tmp_path / '.key.bin'), + '--no-refresh-keys', + '--require-signed-manifest', + str(tmp_path)]) + if str(gemato.exceptions.OpenPGPNoImplementation('')) in caplog.text: + pytest.skip('OpenPGP implementation missing') + eexit = 0 if expected is None else 1 + assert retval == eexit if expected is not None: assert str(expected('')) in caplog.text -- cgit v1.2.3