debian-forge/test/mod/test_util_osrelease.py
David Rheinsberg 20cf5dba6a test: '{. -> ./mod}/test_util_osrelease.py'
Move the os-release tests to the module-level tests and align its
coding-style with the others.
2020-04-28 15:39:00 +02:00

22 lines
660 B
Python

#
# Tests for the `osbuild.util.osrelease` module.
#
import os
import unittest
from osbuild.util import osrelease
class TestUtilOSRelease(unittest.TestCase):
def test_non_existant(self):
"""Verify default os-release value, if no files are given."""
self.assertEqual(osrelease.describe_os(), "linux")
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"):
with self.subTest(entry.name):
self.assertEqual(osrelease.describe_os(entry.path), entry.name)