From d5a03168776f92023c0f5a98b98fb653b0adcfdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Mon, 4 Dec 2017 12:30:18 +0100 Subject: [PATCH] Use dnf backend for repoclosure on PY3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When yum is not available, it makes no sense to offer it as an option. Signed-off-by: Lubomír Sedlář --- doc/configuration.rst | 2 +- pungi/checks.py | 5 +++-- tests/test_config.py | 3 ++- tests/test_test_phase.py | 4 +++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/doc/configuration.rst b/doc/configuration.rst index f184e8ee..9f801d63 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -172,7 +172,7 @@ Options (*str*) -- Select which tool should be used to run repoclosure over created repositories. By default ``yum`` is used, but you can switch to ``dnf``. Please note that when ``dnf`` is used, the build dependencies check is - skipped. + skipped. On Python 3, only ``dnf`` backend is available. **compose_type** (*str*) -- Allows to set default compose type. Type set via a command-line diff --git a/pungi/checks.py b/pungi/checks.py index 0206cbe3..9fc40b81 100644 --- a/pungi/checks.py +++ b/pungi/checks.py @@ -614,8 +614,9 @@ def make_schema(): }), "repoclosure_backend": { "type": "string", - "default": "yum", - "enum": ["yum", "dnf"], + # Gather and repoclosure both have the same backends: yum + dnf + "default": _get_default_gather_backend(), + "enum": _get_gather_backends(), }, "old_composes_per_release_type": { diff --git a/tests/test_config.py b/tests/test_config.py index 702457bc..5a75cff1 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -427,9 +427,10 @@ class RepoclosureTestCase(ConfigTestCase): repoclosure_backend='fnd', # Intentionally with a typo ) + options = ['yum', 'dnf'] if six.PY2 else ['dnf'] self.assertValidation( cfg, - ["Failed validation in repoclosure_backend: 'fnd' is not one of ['yum', 'dnf']"]) + ["Failed validation in repoclosure_backend: 'fnd' is not one of %s" % options]) if __name__ == '__main__': diff --git a/tests/test_test_phase.py b/tests/test_test_phase.py index b06cb2d1..d2dda657 100644 --- a/tests/test_test_phase.py +++ b/tests/test_test_phase.py @@ -192,7 +192,9 @@ class TestRepoclosure(PungiTestCase): @mock.patch('pungi.wrappers.repoclosure.get_repoclosure_cmd') @mock.patch('pungi.phases.test.run') def test_repoclosure_default_backend(self, mock_run, mock_grc): - compose = DummyCompose(self.topdir, {}) + with mock.patch('six.PY2', new=True): + compose = DummyCompose(self.topdir, {}) + test_phase.run_repoclosure(compose) self.assertItemsEqual(