debian-forge/test/mod/test_util_osrelease.py
David Rheinsberg 240905d4a0 test: make TestBase inherit unittest.TestCase
We want to extend our base-class to support extensions to
unittest.TestCase, so make sure we inherit from it.

Adjust all callers to no longer inherit from TestCase, since this is now
done automatically by TestBase.
2020-06-05 09:27:40 +02:00

30 lines
818 B
Python

#
# Tests for the `osbuild.util.osrelease` module.
#
import os
import unittest
from osbuild.util import osrelease
from .. import test
class TestUtilOSRelease(test.TestBase):
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(os.path.join(self.locate_test_data(), "os-release")):
with self.subTest(entry.name):
self.assertEqual(osrelease.describe_os(entry.path), entry.name)