public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/test/eclean/
@ 2020-12-28 17:52 Matt Turner
  0 siblings, 0 replies; 2+ messages in thread
From: Matt Turner @ 2020-12-28 17:52 UTC (permalink / raw
  To: gentoo-commits

commit:     e0bce6f37f4bbee9eb3d77931396ee5aaeafdeea
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 21 03:23:07 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Mon Dec 21 03:24:54 2020 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=e0bce6f3

eclean: Remove unneeded __init__ to enable pytest

Prevented the unit test from running:

pym/gentoolkit/test/eclean/distsupport.py:435: PytestCollectionWarning:
cannot collect test class 'TestDisfiles' because it has a __init__
constructor (from: pym/gentoolkit/test/eclean/test_search.py)

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 pym/gentoolkit/test/eclean/distsupport.py | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/pym/gentoolkit/test/eclean/distsupport.py b/pym/gentoolkit/test/eclean/distsupport.py
index 0fc2db8..da7cdbb 100644
--- a/pym/gentoolkit/test/eclean/distsupport.py
+++ b/pym/gentoolkit/test/eclean/distsupport.py
@@ -434,12 +434,6 @@ class OutputSimulator:
 
 class TestDisfiles:
 
-	def __init__(self):
-		self.workdir = None
-		self.target_file = None
-		self.target_symlink = None
-		self.test_filepaths = None
-
 	def setUp(self):
 		# create the dist dir
 		self.tmpdir = mkdtemp()


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/test/eclean/
@ 2024-02-18  2:19 Brian Dolbec
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Dolbec @ 2024-02-18  2:19 UTC (permalink / raw
  To: gentoo-commits

commit:     a1e25deeab64dcb7334381854db23a564d2d2c02
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 18 00:59:22 2024 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Feb 18 02:16:28 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=a1e25dee

Initial tests for _deps_equal()

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/gentoolkit/test/eclean/test_search.py | 157 ++++++++++++++++++++++++++++++
 1 file changed, 157 insertions(+)

diff --git a/pym/gentoolkit/test/eclean/test_search.py b/pym/gentoolkit/test/eclean/test_search.py
index 32d360c..0bbad46 100755
--- a/pym/gentoolkit/test/eclean/test_search.py
+++ b/pym/gentoolkit/test/eclean/test_search.py
@@ -26,8 +26,11 @@ from gentoolkit.test.eclean.distsupport import (
 )
 import gentoolkit.eclean.search as search
 from gentoolkit.eclean.search import DistfilesSearch
+from gentoolkit.eclean.search import _deps_equal
 from gentoolkit.eclean.exclude import parseExcludeFile
 
+from portage.dep import Atom
+
 """Tests for eclean's distfiles search functions."""
 
 
@@ -670,12 +673,166 @@ class TestRemoveProtected(unittest.TestCase):
         )
 
 
+class TestDepsEqual(unittest.TestCase):
+
+    def test_deps_equal(self):
+        # def _deps_equal(deps_a, eapi_a, deps_b, eapi_b, libc_deps, uselist=None, cpv=None):
+        all_tests = [
+            # 1 equal
+            (
+                "x11-misc/xdg-user-dirs-gtk-0.11",
+                {
+                    "deps_a": "dev-libs/glib:2 >=x11-libs/gtk+-3.5.1:3 >=x11-misc/xdg-user-dirs-0.14",
+                    "eapi_a": "8",
+                    "deps_b": "dev-libs/glib:2 >=x11-libs/gtk+-3.5.1:3 >=x11-misc/xdg-user-dirs-0.14",
+                    "eapi_b": "8",
+                    "libc_deps": {Atom("sys-libs/glibc:2.2")},
+                    "uselist": frozenset(
+                        {
+                            "elibc_glibc",
+                            "amd64",
+                            "abi_x86_64",
+                            "kernel_linux",
+                            "userland_GNU",
+                        }
+                    ),
+                },
+                True,
+            ),
+            # 2 ebuild different gtk+ dep
+            (
+                "x11-misc/xdg-user-dirs-gtk-0.11",
+                {
+                    "deps_a": "dev-libs/glib:2 >=x11-libs/gtk+-3.5.1:3 >=x11-misc/xdg-user-dirs-0.14",
+                    "eapi_a": "8",
+                    "deps_b": "dev-libs/glib:2 >=x11-libs/gtk+-3.5.2:3 >=x11-misc/xdg-user-dirs-0.14",
+                    "eapi_b": "8",
+                    "libc_deps": {Atom("sys-libs/glibc:2.2")},
+                    "uselist": frozenset(
+                        {
+                            "elibc_glibc",
+                            "amd64",
+                            "abi_x86_64",
+                            "kernel_linux",
+                            "userland_GNU",
+                        }
+                    ),
+                },
+                False,
+            ),
+            # 3 different eapi, but is not currently tested
+            (
+                "x11-misc/xdg-user-dirs-gtk-0.11",
+                {
+                    "deps_a": "dev-libs/glib:2 >=x11-libs/gtk+-3.5.1:3 >=x11-misc/xdg-user-dirs-0.14",
+                    "eapi_a": "7",
+                    "deps_b": "dev-libs/glib:2 >=x11-libs/gtk+-3.5.1:3 >=x11-misc/xdg-user-dirs-0.14",
+                    "eapi_b": "8",
+                    "libc_deps": {Atom("sys-libs/glibc:2.2")},
+                    "uselist": frozenset(
+                        {
+                            "elibc_glibc",
+                            "amd64",
+                            "abi_x86_64",
+                            "kernel_linux",
+                            "userland_GNU",
+                        }
+                    ),
+                },
+                True,
+            ),
+            # 4 valid/False
+            (
+                "x11-misc/xdg-user-dirs-0.18",
+                {
+                    "deps_a": "dev-libs/glib:2 >=x11-libs/gtk+-3.5.1:3 >=x11-misc/xdg-user-dirs-0.14",
+                    "eapi_a": "8",
+                    "deps_b": "gtk? ( x11-misc/xdg-user-dirs-gtk )",
+                    "eapi_b": "8",
+                    "libc_deps": {Atom("sys-libs/glibc:2.2")},
+                    "uselist": frozenset(
+                        {
+                            "elibc_glibc",
+                            "amd64",
+                            "abi_x86_64",
+                            "kernel_linux",
+                            "userland_GNU",
+                        }
+                    ),
+                },
+                False,
+            ),
+            # 5 ebuild InvalidDependString
+            (
+                "x11-misc/xdg-user-dirs-0.18",
+                {
+                    "deps_a": "dev-libs/glib:2 >=x11-libs/gtk+-3.5.1:3 >=x11-misc/xdg-user-dirs-0.14",
+                    "eapi_a": "8",
+                    "deps_b": "gtk? ( )",
+                    "eapi_b": "8",
+                    "libc_deps": {Atom("sys-libs/glibc:2.2")},
+                    "uselist": frozenset(
+                        {
+                            "elibc_glibc",
+                            "amd64",
+                            "abi_x86_64",
+                            "kernel_linux",
+                            "userland_GNU",
+                        }
+                    ),
+                },
+                True,
+            ),
+            # 6 binpkg InvalidDependString
+            (
+                "x11-misc/xdg-user-dirs-0.18",
+                {
+                    "deps_a": "gtk? ( )",
+                    "eapi_a": "8",
+                    "deps_b": "gtk? ( x11-misc/xdg-user-dirs-gtk )",
+                    "eapi_b": "8",
+                    "libc_deps": {Atom("sys-libs/glibc:2.2")},
+                    "uselist": frozenset(
+                        {
+                            "elibc_glibc",
+                            "amd64",
+                            "abi_x86_64",
+                            "kernel_linux",
+                            "userland_GNU",
+                        }
+                    ),
+                },
+                False,
+            ),
+        ]
+        x = 1
+        for test in all_tests:
+            cpv = test[0]
+            data = test[1]
+            # print(x, cpv)  # for debug testing
+            self.assertEqual(
+                _deps_equal(
+                    data["deps_a"],
+                    data["eapi_a"],
+                    data["deps_b"],
+                    data["eapi_b"],
+                    data["libc_deps"],
+                    data["uselist"],
+                    cpv,
+                ),
+                test[2],
+            )
+            x += 1
+            # print("####################")  # for debug testing
+
+
 def test_main():
     suite = unittest.TestLoader()
     suite.loadTestsFromTestCase(TestCheckLimits)
     suite.loadTestsFromTestCase(TestFetchRestricted)
     suite.loadTestsFromTestCase(TestNonDestructive)
     suite.loadTestsFromTestCase(TestRemoveProtected)
+    suite.loadTestsFromTestCase(TestDepsEqual)
     unittest.TextTestRunner(verbosity=2).run(suite)
 
 


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-18  2:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-18  2:19 [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/test/eclean/ Brian Dolbec
  -- strict thread matches above, loose matches on Subject: below --
2020-12-28 17:52 Matt Turner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox