test/gpg: init from the testing key directory

The old testing pattern set an attribute on the parser directly. Now
that there is a parsed flag, use it instead.
This commit is contained in:
Ben Boeckel 2017-08-24 08:47:52 -04:00 committed by Todd Gamblin
parent f564b2abf7
commit 0e7071befe

View File

@ -39,14 +39,6 @@ def testing_gpg_directory(tmpdir):
gpg_util.GNUPGHOME = old_gpg_path
@pytest.fixture(scope='function')
def mock_gpg_config():
orig_gpg_keys_path = spack.gpg_keys_path
spack.gpg_keys_path = spack.mock_gpg_keys_path
yield
spack.gpg_keys_path = orig_gpg_keys_path
@pytest.fixture(scope='function')
def gpg():
return SpackCommand('gpg')
@ -60,16 +52,15 @@ def has_gnupg2():
return False
@pytest.mark.xfail # TODO: fix failing tests.
@pytest.mark.skipif(not has_gnupg2(),
reason='These tests require gnupg2')
def test_gpg(gpg, tmpdir, testing_gpg_directory, mock_gpg_config):
def test_gpg(gpg, tmpdir, testing_gpg_directory):
# Verify a file with an empty keyring.
with pytest.raises(ProcessError):
gpg('verify', os.path.join(spack.mock_gpg_data_path, 'content.txt'))
# Import the default key.
gpg('init')
gpg('init', '--from', spack.mock_gpg_keys_path)
# List the keys.
# TODO: Test the output here.