Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion dnf-behave-tests/common/lib/os_version.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
# -*- coding: utf-8 -*-

import distro
import rpm


def detect_os_version():
os_id = distro.id()
major_version = distro.major_version()

# treat centos as RHEL in context of scenario tag matching
if os_id == "centos":
os_id = "rhel"

return os_id + "__" + distro.major_version()
# Treat anything that defines non-empty "rhel" RPM macro as RHEL.
# That's especially needed to handle Fedora ELN as RHEL.
rhel_macro_version = int(rpm.expandMacro("0%{?rhel}"))
if rhel_macro_version > 0:
os_id = "rhel"
major_version = str(rhel_macro_version)

return os_id + "__" + major_version
1 change: 1 addition & 0 deletions dnf-behave-tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
behave
pexpect
pyftpdlib