Skip to content

Commit

Permalink
Merge branch 'master' into pedrolamas/ignore-board-release
Browse files Browse the repository at this point in the history
  • Loading branch information
HorlogeSkynet committed Mar 11, 2023
2 parents 45711d1 + 40ecdd9 commit 4a04a0c
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/distro/distro.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ class InfoDict(TypedDict):
# Base file names to be looked up for if _UNIXCONFDIR is not readable.
_DISTRO_RELEASE_BASENAMES = [
"SuSE-release",
"altlinux-release",
"arch-release",
"base-release",
"centos-release",
Expand Down Expand Up @@ -244,6 +245,7 @@ def id() -> str:
"rocky" Rocky Linux
"aix" AIX
"guix" Guix System
"altlinux" ALT Linux
============== =========================================
If you have a need to get distros for reliable IDs added into this set,
Expand Down
1 change: 1 addition & 0 deletions tests/resources/distros/altlinux10/etc/altlinux-release
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALT Server 10.1 (Mendelevium)
1 change: 1 addition & 0 deletions tests/resources/distros/altlinux10/etc/fedora-release
10 changes: 10 additions & 0 deletions tests/resources/distros/altlinux10/etc/os-release
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
NAME="ALT Server"
VERSION="10.1"
ID=altlinux
VERSION_ID=10.1
PRETTY_NAME="ALT Server 10.1 (Mendelevium)"
ANSI_COLOR="1;33"
CPE_NAME="cpe:/o:alt:server:10.1"
BUILD_ID="ALT Server 10.1"
HOME_URL="https://basealt.ru/"
BUG_REPORT_URL="https://bugs.altlinux.org/"
1 change: 1 addition & 0 deletions tests/resources/distros/altlinux10/etc/redhat-release
1 change: 1 addition & 0 deletions tests/resources/distros/altlinux10/etc/system-release
49 changes: 49 additions & 0 deletions tests/test_distro.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,19 @@ def test_cloudlinux7_os_release(self) -> None:
}
self._test_outcome(desired_outcome)

def test_altlinux10_os_release(self) -> None:
desired_outcome = {
"id": "altlinux",
"name": "ALT Server",
"pretty_name": "ALT Server 10.1 (Mendelevium)",
"version": "10.1",
"pretty_version": "10.1",
"best_version": "10.1",
"major_version": "10",
"minor_version": "1",
}
self._test_outcome(desired_outcome)

def test_bttcb1_os_release(self) -> None:
desired_outcome = {
"id": "debian",
Expand Down Expand Up @@ -1095,6 +1108,20 @@ def test_cloudlinux7_dist_release(self) -> None:
}
self._test_outcome(desired_outcome, "cloudlinux", "7", "redhat")

def test_altlinux10_dist_release(self) -> None:
desired_outcome = {
"id": "altlinux",
"name": "ALT Server",
"codename": "Mendelevium",
"pretty_name": "ALT Server 10.1 (Mendelevium)",
"version": "10.1",
"pretty_version": "10.1 (Mendelevium)",
"best_version": "10.1",
"major_version": "10",
"minor_version": "1",
}
self._test_outcome(desired_outcome, "altlinux", "10")


@pytest.mark.skipif(not IS_LINUX, reason="Irrelevant on non-linux")
class TestOverall(DistroTestCase):
Expand Down Expand Up @@ -1844,6 +1871,28 @@ def test_cloudlinux7_release(self) -> None:
}
self._test_outcome(desired_outcome)

def test_altlinux10_release(self) -> None:
desired_outcome = {
"id": "altlinux",
"name": "ALT Server",
"codename": "Mendelevium",
"pretty_name": "ALT Server 10.1 (Mendelevium)",
"version": "10.1",
"pretty_version": "10.1 (Mendelevium)",
"best_version": "10.1",
"major_version": "10",
"minor_version": "1",
}
self._test_outcome(desired_outcome)

desired_info = {
"id": "altlinux",
"name": "ALT Server",
"version_id": "10.1",
"codename": "Mendelevium",
}
self._test_release_file_info("altlinux-release", desired_info)


def _bad_os_listdir(path: str = ".") -> NoReturn:
"""This function is used by TestOverallWithEtcNotReadable to simulate
Expand Down

0 comments on commit 4a04a0c

Please sign in to comment.