distro-info: updated distro-info test set for ecne build.
This commit is contained in:
parent
bff68c8db0
commit
d73f931452
4 changed files with 179 additions and 15 deletions
|
|
@ -1,5 +1,7 @@
|
|||
--- source/python/distro_info.py 2021-11-04 15:27:37.000000000 -0600
|
||||
+++ source/python/distro_info.py_fix 2022-04-06 10:20:39.217365952 -0500
|
||||
diff --git a/python/distro_info.py b/python/distro_info.py
|
||||
index c87fbff6..0a624745 100644
|
||||
--- a/python/distro_info.py
|
||||
+++ b/python/distro_info.py
|
||||
@@ -1,3 +1,4 @@
|
||||
+# Copyright (C) 2021, Trisquel GNU/Linux developers <trisquel-devel@listas.trisquel.info>
|
||||
# Copyright (C) 2009-2012, Benjamin Drung <bdrung@debian.org>
|
||||
|
|
@ -23,7 +25,7 @@
|
|||
"""
|
||||
|
||||
def __init__(self, distro):
|
||||
@@ -311,14 +312,14 @@
|
||||
@@ -340,16 +340,16 @@ class DebianDistroInfo(DistroInfo):
|
||||
]
|
||||
|
||||
|
||||
|
|
@ -32,31 +34,35 @@
|
|||
+class TrisquelDistroInfo(DistroInfo):
|
||||
+ """provides information about Trisquel's distributions"""
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
- super().__init__("Ubuntu")
|
||||
+ super().__init__("Trisquel")
|
||||
|
||||
def lts(self, date=None, result="codename"):
|
||||
def lts(
|
||||
self, date: typing.Optional[datetime.date] = None, result: str = "codename"
|
||||
) -> typing.Union[DistroRelease, str]:
|
||||
- """Get latest long term support (LTS) Ubuntu distribution based on the
|
||||
+ """Get latest long term support (LTS) Trisquel distribution based on the
|
||||
given date."""
|
||||
if date is None:
|
||||
date = self._date
|
||||
@@ -337,7 +338,7 @@
|
||||
return "LTS" in distros[0].version
|
||||
|
||||
def supported(self, date=None, result="codename"):
|
||||
@@ -372,7 +372,7 @@ class UbuntuDistroInfo(DistroInfo):
|
||||
def supported(
|
||||
self, date: typing.Optional[datetime.date] = None, result: str = "codename"
|
||||
) -> list[typing.Union[DistroRelease, str]]:
|
||||
- """Get list of all supported Ubuntu distributions based on the given
|
||||
+ """Get list of all supported Trisquel distributions based on the given
|
||||
date."""
|
||||
if date is None:
|
||||
date = self._date
|
||||
@@ -347,15 +348,3 @@
|
||||
if date <= x.eol or (x.eol_server is not None and date <= x.eol_server)
|
||||
@@ -382,17 +382,3 @@ class UbuntuDistroInfo(DistroInfo):
|
||||
if (x.eol and date <= x.eol) or (x.eol_server is not None and date <= x.eol_server)
|
||||
]
|
||||
return distros
|
||||
-
|
||||
- def supported_esm(self, date=None, result="codename"):
|
||||
- def supported_esm(
|
||||
- self, date: typing.Optional[datetime.date] = None, result: str = "codename"
|
||||
- ) -> list[typing.Union[DistroRelease, str]]:
|
||||
- """Get list of all ESM supported Ubuntu distributions based on the
|
||||
- given date."""
|
||||
- if date is None:
|
||||
|
|
|
|||
152
helpers/DATA/distro-info/test_distro_info.py.patch
Normal file
152
helpers/DATA/distro-info/test_distro_info.py.patch
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
diff --git a/python/distro_info_test/test_distro_info.py b/python/distro_info_test/test_distro_info.py
|
||||
index b9e1cc13..94474bf5 100644
|
||||
--- a/python/distro_info_test/test_distro_info.py
|
||||
+++ b/python/distro_info_test/test_distro_info.py
|
||||
@@ -1,5 +1,6 @@
|
||||
# test_distro_info.py - Test suite for distro_info
|
||||
#
|
||||
+# Copyright (C) 2024, Trisquel GNU/Linux developers <trisquel-devel@listas.trisquel.info>
|
||||
# Copyright (C) 2011, Benjamin Drung <bdrung@debian.org>
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
@@ -19,7 +20,7 @@
|
||||
import datetime
|
||||
import unittest
|
||||
|
||||
-from distro_info import DebianDistroInfo, UbuntuDistroInfo
|
||||
+from distro_info import DebianDistroInfo, TrisquelDistroInfo
|
||||
|
||||
|
||||
class DebianDistroInfoTestCase(unittest.TestCase): # pylint: disable=too-many-public-methods
|
||||
@@ -122,91 +123,89 @@ class DebianDistroInfoTestCase(unittest.TestCase): # pylint: disable=too-many-p
|
||||
self.assertEqual(self._distro_info.stable(self._date, result="release"), "5.0")
|
||||
|
||||
|
||||
-class UbuntuDistroInfoTestCase(unittest.TestCase): # pylint: disable=too-many-public-methods
|
||||
- """TestCase object for distro_info.UbuntuDistroInfo"""
|
||||
+class TrisquelDistroInfoTestCase(unittest.TestCase): # pylint: disable=too-many-public-methods
|
||||
+ """TestCase object for distro_info.TrisquelDistroInfo"""
|
||||
|
||||
def setUp(self) -> None: # pylint: disable=invalid-name
|
||||
- self._distro_info = UbuntuDistroInfo()
|
||||
+ self._distro_info = TrisquelDistroInfo()
|
||||
self._date = datetime.date(2011, 1, 10)
|
||||
|
||||
def test_all(self) -> None:
|
||||
- """Test: List all known Ubuntu distributions."""
|
||||
+ """Test: List all known Trisquel distributions."""
|
||||
all_distros = {
|
||||
- "warty",
|
||||
- "hoary",
|
||||
- "breezy",
|
||||
- "dapper",
|
||||
- "edgy",
|
||||
- "feisty",
|
||||
- "gutsy",
|
||||
- "hardy",
|
||||
- "intrepid",
|
||||
- "jaunty",
|
||||
- "karmic",
|
||||
- "lucid",
|
||||
- "maverick",
|
||||
- "natty",
|
||||
+ "robur",
|
||||
+ "dwyn",
|
||||
+ "awen",
|
||||
+ "taranis",
|
||||
+ "slaine",
|
||||
+ "dagda",
|
||||
+ "brigantia",
|
||||
+ "toutanis",
|
||||
+ "belenos",
|
||||
+ "flidas",
|
||||
+ "etiona",
|
||||
+ "nabia",
|
||||
}
|
||||
self.assertEqual(all_distros - set(self._distro_info.all), set())
|
||||
|
||||
def test_devel(self) -> None:
|
||||
- """Test: Get latest development Ubuntu distribution."""
|
||||
- self.assertEqual(self._distro_info.devel(self._date), "natty")
|
||||
+ """Test: Get latest development Trisquel distribution."""
|
||||
+ self.assertEqual(self._distro_info.devel(self._date), "dagda")
|
||||
|
||||
def test_lts(self) -> None:
|
||||
- """Test: Get latest long term support (LTS) Ubuntu distribution."""
|
||||
- self.assertEqual(self._distro_info.lts(self._date), "lucid")
|
||||
+ """Test: Get latest long term support (LTS) Trisquel distribution."""
|
||||
+ self.assertEqual(self._distro_info.lts(self._date), "taranis")
|
||||
|
||||
def test_stable(self) -> None:
|
||||
- """Test: Get latest stable Ubuntu distribution."""
|
||||
- self.assertEqual(self._distro_info.stable(self._date), "maverick")
|
||||
+ """Test: Get latest stable Trisquel distribution."""
|
||||
+ self.assertEqual(self._distro_info.stable(self._date), "taranis")
|
||||
|
||||
def test_supported(self) -> None:
|
||||
- """Test: List all supported Ubuntu distribution."""
|
||||
- supported = ["dapper", "hardy", "karmic", "lucid", "maverick", "natty"]
|
||||
+ """Test: List all supported Trisquel distribution."""
|
||||
+ supported = ["robur", "awen", "taranis", "slaine", "dagda"]
|
||||
self.assertEqual(self._distro_info.supported(self._date), supported)
|
||||
|
||||
def test_unsupported(self) -> None:
|
||||
- """Test: List all unsupported Ubuntu distributions."""
|
||||
- unsupported = ["warty", "hoary", "breezy", "edgy", "feisty", "gutsy", "intrepid", "jaunty"]
|
||||
+ """Test: List all unsupported Trisquel distributions."""
|
||||
+ unsupported = ["dwyn"]
|
||||
self.assertEqual(self._distro_info.unsupported(self._date), unsupported)
|
||||
|
||||
def test_current_unsupported(self) -> None:
|
||||
- """Test: List all unsupported Ubuntu distributions today."""
|
||||
- unsupported = {"warty", "hoary", "breezy", "edgy", "feisty", "gutsy", "intrepid", "jaunty"}
|
||||
+ """Test: List all unsupported Trisquel distributions today."""
|
||||
+ unsupported = {"robur", "dwyn"}
|
||||
self.assertEqual(unsupported - set(str(d) for d in self._distro_info.unsupported()), set())
|
||||
|
||||
def test_valid(self) -> None:
|
||||
- """Test: Check for valid Ubuntu distribution."""
|
||||
- self.assertTrue(self._distro_info.valid("lucid"))
|
||||
+ """Test: Check for valid Trisquel distribution."""
|
||||
+ self.assertTrue(self._distro_info.valid("taranis"))
|
||||
self.assertFalse(self._distro_info.valid("42"))
|
||||
|
||||
def test_is_lts(self) -> None:
|
||||
- """Test: Check if Ubuntu distribution is an LTS."""
|
||||
- self.assertTrue(self._distro_info.is_lts("lucid"))
|
||||
+ """Test: Check if Trisquel distribution is an LTS."""
|
||||
+ self.assertTrue(self._distro_info.is_lts("taranis"))
|
||||
self.assertFalse(self._distro_info.is_lts("42"))
|
||||
self.assertFalse(self._distro_info.is_lts("warty"))
|
||||
|
||||
def test_codename(self) -> None:
|
||||
"""Test: Check result set to codename."""
|
||||
- self.assertEqual(self._distro_info.lts(self._date, "codename"), "lucid")
|
||||
- self.assertEqual(self._distro_info.devel(self._date, result="codename"), "natty")
|
||||
+ self.assertEqual(self._distro_info.lts(self._date, "codename"), "taranis")
|
||||
+ self.assertEqual(self._distro_info.devel(self._date, result="codename"), "dagda")
|
||||
|
||||
def test_version(self) -> None:
|
||||
"""Test: Check result set to version."""
|
||||
- self.assertEqual(self._distro_info.version("lucid"), "10.04 LTS")
|
||||
- self.assertEqual(self._distro_info.version("Maverick Meerkat"), "10.10")
|
||||
+ self.assertEqual(self._distro_info.version("taranis"), "4.0 LTS")
|
||||
+ self.assertEqual(self._distro_info.version("Slaine"), "4.5")
|
||||
|
||||
def test_fullname(self) -> None:
|
||||
"""Test: Check result set to fullname."""
|
||||
self.assertEqual(
|
||||
- self._distro_info.stable(self._date, "fullname"), 'Ubuntu 10.10 "Maverick Meerkat"'
|
||||
+ self._distro_info.stable(self._date, "fullname"), 'Trisquel 4.0 LTS "Taranis"'
|
||||
)
|
||||
self.assertEqual(
|
||||
- self._distro_info.lts(self._date, result="fullname"), 'Ubuntu 10.04 LTS "Lucid Lynx"'
|
||||
+ self._distro_info.lts(self._date, result="fullname"), 'Trisquel 4.0 LTS "Taranis"'
|
||||
)
|
||||
|
||||
def test_release(self) -> None:
|
||||
"""Test: Check result set to release."""
|
||||
- self.assertEqual(self._distro_info.devel(self._date, "release"), "11.04")
|
||||
- self.assertEqual(self._distro_info.lts(self._date, result="release"), "10.04 LTS")
|
||||
+ self.assertEqual(self._distro_info.devel(self._date, "release"), "5.0")
|
||||
+ self.assertEqual(self._distro_info.lts(self._date, result="release"), "4.0 LTS")
|
||||
|
|
@ -1,3 +1,8 @@
|
|||
##
|
||||
# This file is used for reference when the patch needs updating.
|
||||
# only remove it when you no longer need it on the next release
|
||||
# e.g. T12 > T13, etc.
|
||||
##
|
||||
# test_distro_info.py - Test suite for distro_info
|
||||
#
|
||||
# Copyright (C) 2021, Trisquel GNU/Linux developers <trisquel-devel@listas.trisquel.info>
|
||||
Loading…
Add table
Add a link
Reference in a new issue