From b830bb74801d7001daf71c052c42632e03eae2a9 Mon Sep 17 00:00:00 2001 From: David Rheinsberg Date: Wed, 6 May 2020 11:32:55 +0200 Subject: [PATCH] test: convert os-release-tests to test-data Use the new `locate_test_data()` helper to get access to test-data. Guard the test with `have_test_data()` to skip it in case test-data access is not available. --- test/{ => data}/os-release/arch | 0 test/{ => data}/os-release/fedora30 | 0 test/{ => data}/os-release/fedora31 | 0 test/{ => data}/os-release/fedora32 | 0 test/{ => data}/os-release/fedora33 | 0 test/{ => data}/os-release/linux | 0 test/{ => data}/os-release/rhel81 | 0 test/{ => data}/os-release/rhel82 | 0 test/{ => data}/os-release/ubuntu1804 | 0 test/mod/test_util_osrelease.py | 7 +++++-- 10 files changed, 5 insertions(+), 2 deletions(-) rename test/{ => data}/os-release/arch (100%) rename test/{ => data}/os-release/fedora30 (100%) rename test/{ => data}/os-release/fedora31 (100%) rename test/{ => data}/os-release/fedora32 (100%) rename test/{ => data}/os-release/fedora33 (100%) rename test/{ => data}/os-release/linux (100%) rename test/{ => data}/os-release/rhel81 (100%) rename test/{ => data}/os-release/rhel82 (100%) rename test/{ => data}/os-release/ubuntu1804 (100%) diff --git a/test/os-release/arch b/test/data/os-release/arch similarity index 100% rename from test/os-release/arch rename to test/data/os-release/arch diff --git a/test/os-release/fedora30 b/test/data/os-release/fedora30 similarity index 100% rename from test/os-release/fedora30 rename to test/data/os-release/fedora30 diff --git a/test/os-release/fedora31 b/test/data/os-release/fedora31 similarity index 100% rename from test/os-release/fedora31 rename to test/data/os-release/fedora31 diff --git a/test/os-release/fedora32 b/test/data/os-release/fedora32 similarity index 100% rename from test/os-release/fedora32 rename to test/data/os-release/fedora32 diff --git a/test/os-release/fedora33 b/test/data/os-release/fedora33 similarity index 100% rename from test/os-release/fedora33 rename to test/data/os-release/fedora33 diff --git a/test/os-release/linux b/test/data/os-release/linux similarity index 100% rename from test/os-release/linux rename to test/data/os-release/linux diff --git a/test/os-release/rhel81 b/test/data/os-release/rhel81 similarity index 100% rename from test/os-release/rhel81 rename to test/data/os-release/rhel81 diff --git a/test/os-release/rhel82 b/test/data/os-release/rhel82 similarity index 100% rename from test/os-release/rhel82 rename to test/data/os-release/rhel82 diff --git a/test/os-release/ubuntu1804 b/test/data/os-release/ubuntu1804 similarity index 100% rename from test/os-release/ubuntu1804 rename to test/data/os-release/ubuntu1804 diff --git a/test/mod/test_util_osrelease.py b/test/mod/test_util_osrelease.py index 6f1f387e..756c7965 100644 --- a/test/mod/test_util_osrelease.py +++ b/test/mod/test_util_osrelease.py @@ -7,16 +7,19 @@ import unittest from osbuild.util import osrelease +from .. import test -class TestUtilOSRelease(unittest.TestCase): + +class TestUtilOSRelease(test.TestBase, unittest.TestCase): def test_non_existant(self): """Verify default os-release value, if no files are given.""" self.assertEqual(osrelease.describe_os(), "linux") + @unittest.skipUnless(test.TestBase.have_test_data(), "no test-data access") def test_describe_os(self): """Test host os detection. test/os-release contains the os-release files for all supported runners. """ - for entry in os.scandir("test/os-release"): + for entry in os.scandir(os.path.join(self.locate_test_data(), "os-release")): with self.subTest(entry.name): self.assertEqual(osrelease.describe_os(entry.path), entry.name)