From 526adc345a34d3af8ba663cd4b6b9bc1833cb653 Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Wed, 15 Nov 2023 09:07:30 +0100 Subject: [PATCH 1/2] GHA: Update test matrix to run on Fedora 38 and 39 --- .github/workflows/build-install.yaml | 3 ++- .github/workflows/tests.yaml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-install.yaml b/.github/workflows/build-install.yaml index fff9fd0f22..7665d70d13 100644 --- a/.github/workflows/build-install.yaml +++ b/.github/workflows/build-install.yaml @@ -27,7 +27,8 @@ jobs: container: # Fedora - - 'registry.fedoraproject.org/fedora:36' + - 'registry.fedoraproject.org/fedora:38' + - 'registry.fedoraproject.org/fedora:39' - 'registry.fedoraproject.org/fedora:rawhide' # OpenSUSE diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index a16d60ce6b..685ed3a97b 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -26,7 +26,8 @@ jobs: container: # Fedora - - 'registry.fedoraproject.org/fedora:36' + - 'registry.fedoraproject.org/fedora:38' + - 'registry.fedoraproject.org/fedora:39' - 'registry.fedoraproject.org/fedora:rawhide' # openSUSE From 69a68b06b31fc445c2ce277a7ae90fcff1175578 Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Wed, 15 Nov 2023 09:14:52 +0100 Subject: [PATCH 2/2] Fix conf.write_initial_config() to use read_file() instead of deprecated readfp() --- osc/conf.py | 2 +- tests/test_conf.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/osc/conf.py b/osc/conf.py index bf414f9de1..49d30d280b 100644 --- a/osc/conf.py +++ b/osc/conf.py @@ -1716,7 +1716,7 @@ def write_initial_config(conffile, entries, custom_template='', creds_mgr_descri config.update(entries) sio = StringIO(conf_template.strip() % config) cp = OscConfigParser.OscConfigParser() - cp.readfp(sio) + cp.read_file(sio) cp.set(config['apiurl'], 'user', config['user']) if creds_mgr_descriptor: creds_mgr = creds_mgr_descriptor.create(cp) diff --git a/tests/test_conf.py b/tests/test_conf.py index c4fcd3c837..5d6a41d289 100644 --- a/tests/test_conf.py +++ b/tests/test_conf.py @@ -469,5 +469,22 @@ def test_email(self): self.assertEqual(self.host_options.email, "another-user@example.com") +class TestConf(unittest.TestCase): + def setUp(self): + self.tmpdir = tempfile.mkdtemp(prefix="osc_test_") + + def tearDown(self): + shutil.rmtree(self.tmpdir) + + def test_write_initial_config(self): + conffile = os.path.join(self.tmpdir, "oscrc") + entries = { + "user": "Admin", + "pass": "opensuse", + "apiurl": "https://example.com", + } + osc.conf.write_initial_config(conffile, entries) + + if __name__ == "__main__": unittest.main()