diff options
author | Michał Górny <mgorny@gentoo.org> | 2020-08-30 16:24:10 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2020-08-30 16:24:10 +0200 |
commit | 21f919b14a9aeaa08aecbcdd41a530198315aad1 (patch) | |
tree | a23c4663c499324378d6f486c3c8e35ae5ba034c /tests/test_openpgp.py | |
parent | f6dcfd5c6fe1338b74d502284cd524549b6edde9 (diff) | |
download | gemato-21f919b14a9aeaa08aecbcdd41a530198315aad1.tar.gz |
tests: Use module-scope fixtures whenever possible
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'tests/test_openpgp.py')
-rw-r--r-- | tests/test_openpgp.py | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/tests/test_openpgp.py b/tests/test_openpgp.py index ce62add..995c9da 100644 --- a/tests/test_openpgp.py +++ b/tests/test_openpgp.py @@ -37,11 +37,7 @@ from tests.keydata import ( OTHER_PUBLIC_KEY, OTHER_PUBLIC_KEY_UID, OTHER_PUBLIC_KEY_SIG, UNEXPIRE_SIG, ) -from tests.testutil import hkp_server - - -# workaround pyflakes -hkp_server = hkp_server +from tests.testutil import HKPServer VALID_PUBLIC_KEY = PUBLIC_KEY + UID + PUBLIC_KEY_SIG @@ -638,6 +634,22 @@ def test_recursive_manifest_loader_save_submanifest(tmp_path, privkey_env): assert m2.openpgp_signature is None +@pytest.fixture(scope='module') +def global_hkp_server(): + """A fixture that starts a single HKP server instance for tests""" + server = HKPServer() + server.start() + yield server + server.stop() + + +@pytest.fixture +def hkp_server(global_hkp_server): + """A fixture that resets the global HKP server with empty keys""" + global_hkp_server.keys.clear() + yield global_hkp_server + + COMBINED_PUBLIC_KEYS = OTHER_VALID_PUBLIC_KEY + VALID_PUBLIC_KEY |