File: test_firmwares.py

package info (click to toggle)
osinfo-db 0.20221130-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 22,780 kB
  • sloc: python: 1,672; sh: 344; makefile: 89
file content (27 lines) | stat: -rw-r--r-- 902 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# This work is licensed under the GNU GPLv2 or later.
# See the COPYING file in the top-level directory.

from . import util


def _check_duplicate_firmwares(osxml):
    """
    Ensure an OS doesn't list a firmware that's defined in the parent
    """
    broken = []
    related = util.DataFiles.getosxml_related(osxml)
    for osxml2 in related:
        if osxml2.firmwares is not None:
            for firmware2 in osxml2.firmwares:
                for firmware in osxml.firmwares:
                    if (
                        firmware.arch == firmware2.arch
                        and firmware.firmware_type == firmware2.firmware_type
                    ):
                        broken.append([firmware.firmware_type, firmware.arch])
    assert broken == []


@util.os_parametrize("osxml", filter_firmwares=True)
def test_firmwares_duplication(osxml):
    _check_duplicate_firmwares(osxml)