From 085734aeb8d04dcd665ef0bb7bb6dd6f83625822 Mon Sep 17 00:00:00 2001 From: Ondrej Nosek Date: Feb 03 2022 03:41:15 +0000 Subject: Fix Jenkins tests Rpm package is not available in PyPI. Use rpm system library instead. Fix Python 2 tests - unsupported argument. Removed one depraceted warning. Signed-off-by: Ondrej Nosek --- diff --git a/fedpkg/cli.py b/fedpkg/cli.py index b982fe2..58fabbe 100644 --- a/fedpkg/cli.py +++ b/fedpkg/cli.py @@ -1418,7 +1418,15 @@ class fedpkgClient(cliClient): self.log.warning("WARNING: User config file not found at: {0}".format(PATH)) self.log.info("The config file will be created.") # Make sure there is subdirectory already prepared. - os.makedirs(os.path.dirname(PATH), exist_ok=True) + try: + # Use parameter "exist_ok=True" in Python 3 only + os.makedirs(os.path.dirname(PATH)) + except OSError: + # Directory already exists or could not be created. + pass + if not os.path.isdir(os.path.dirname(PATH)): + self.log.error("ERROR: Could not create a directory for the user config file.") + return # Check that the user passed a valid token if self._check_token(TOKEN, token_type): diff --git a/setup.cfg b/setup.cfg index a5d6e51..c69883b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -5,7 +5,6 @@ test = pytest formats = bztar [tool:pytest] -cover-package = fedpkg # additional values for 'addopts' can be: # --cov-report html # -ra -q diff --git a/test/test_retire.py b/test/test_retire.py index 16b94da..d62d1ff 100644 --- a/test/test_retire.py +++ b/test/test_retire.py @@ -53,7 +53,7 @@ class RetireTestCase(unittest.TestCase): return out.strip() def _fake_client(self, args): - config = configparser.SafeConfigParser() + config = configparser.ConfigParser() config.read(TEST_CONFIG) with mock.patch('sys.argv', new=args): client = fedpkgClient(config) diff --git a/tests-requirements.txt b/tests-requirements.txt index cca4322..be75121 100644 --- a/tests-requirements.txt +++ b/tests-requirements.txt @@ -3,6 +3,6 @@ coverage<5.0.0 cccolutils gitpython freezegun -rpm +rpm < 0.0.3 pytest pytest-cov