summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2020-08-26 21:19:37 +0200
committerMichał Górny <mgorny@gentoo.org>2020-08-26 21:19:37 +0200
commit5e046df615fead06e081234f432900146523f645 (patch)
treee950cd333ce7126e70497dac3b6de269779c084e
parent0ce6088801ce600abc0d25f0603560b8a7113071 (diff)
downloadgemato-5e046df615fead06e081234f432900146523f645.tar.gz
tests: Properly skip test_openpgp.py::test_cli when no gpg
Signed-off-by: Michał Górny <mgorny@gentoo.org>
-rw-r--r--tests/test_openpgp.py17
1 files 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