Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double-check that GPG tests run where expected. #1

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions tests/check_gpg_available.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env python

"""
<Program Name>
check_gpg_available.py
<Author>
Zack Newman <[email protected]>
<Started>
September 30, 2022.
<Copyright>
See LICENSE for licensing information.
<Purpose>
The test suite passes even if GPG is not available, because GPG-dependent
tests are skipped if GPG is not present.
This file asserts the availability of GPG, so CI environments that expect GPG
will notice if it goes away unexpectedly rather than silently skipping the GPG
tests.
NOTE: the filename is purposefully check_ rather than test_ so that test
discovery doesn't find this unittest and the tests within are only run
when explicitly invoked.
"""

import unittest

import securesystemslib.gpg.constants


class TestGpgAvailable(unittest.TestCase):
"""Test that securesystemslib finds some GPG executable in the environment."""

def test_gpg_available(self):
"""Test that GPG is available."""
self.assertTrue(securesystemslib.gpg.constants.HAVE_GPG)

if __name__ == "__main__":
unittest.main(verbosity=1, buffer=True)
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ deps =
-r{toxinidir}/requirements-test.txt

commands =
python -m tests.check_gpg_available
coverage run tests/aggregate_tests.py
coverage report -m --fail-under 97

[testenv:purepy38]
deps =

commands =
python -m tests.check_gpg_available
python -m tests.check_public_interfaces

[testenv:py38-no-gpg]
Expand Down