From 9a712654bb1d743d673e3db7829a485e7e5b7f48 Mon Sep 17 00:00:00 2001 From: Chenxiong Qi Date: Oct 18 2017 11:41:28 +0000 Subject: Ignore TestModulesCli if openidc-client is unavailable This is for running tests in downstream client when openidc-client is not used for OpenIDC authentication and not installed in system as well. Especially the case of building rpkg for RHEL6/7 for rhpkg internal use. In which case, Kerberos authentication is used instead, and no Python openidc-client is installed to run tests while building RPM package. Signed-off-by: Chenxiong Qi --- diff --git a/tests/test_cli.py b/tests/test_cli.py index a193eb3..7ca2370 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -24,7 +24,11 @@ from six.moves import StringIO import git import pyrpkg.cli -import openidc_client + +try: + import openidc_client +except ImportError: + openidc_client = None import utils from mock import PropertyMock, call, mock_open, patch, Mock @@ -1705,6 +1709,10 @@ class TestPatch(CliTestCase): os.path.join(cli.cmd.path, patch_file)) +@unittest.skipUnless( + openidc_client, + 'Skip if rpkg is rebuilt for an environment where Kerberos authentication' + 'is used and python-openidc-client is not available.') class TestModulesCli(CliTestCase): """Test module commands""" @@ -1950,7 +1958,7 @@ Components: Name: python-cryptography NVR: None State: FAILED - Koji Task: + Koji Task: """.strip() # noqa: W291 self.assertEqual(expected_output, output)