[PATCH gentoolkit] gentoolkit: Remove gentoolkit.test.cmp

Matt Turner <[email protected]> Mon, 4 Jan 2021 13:22:10 -0500
Newsgroups gmane.linux.gentoo.portage.devel
Message-ID <[email protected]>
Signed-off-by: Matt Turner <[email protected]>
---
Seems to only be used by duplicated unit tests? I guess this might have
been useful when Python 2 was still supported?

 pym/gentoolkit/test/__init__.py  | 23 -----------------------
 pym/gentoolkit/test/test_atom.py | 15 ---------------
 pym/gentoolkit/test/test_cpv.py  | 15 ---------------
 3 files changed, 53 deletions(-)

diff --git a/pym/gentoolkit/test/__init__.py b/pym/gentoolkit/test/__init__.py
index 9e41686..e69de29 100644
--- a/pym/gentoolkit/test/__init__.py
+++ b/pym/gentoolkit/test/__init__.py
@@ -1,23 +0,0 @@
-#!/usr/bin/python
-# Copyright 2009 Gentoo Foundation
-#
-# Distributed under the terms of the GNU General Public License v2
-
-__all__ = ['cmp']
-
-# py3k doesn't have cmp emulate it in order to keep testing cmp
-# in python-2.x
-#XXX: not sure if this is the best place for this
-try:
-	cmp = cmp
-except NameError:
-	def cmp(a, b):
-		if a == b:
-			return 0
-		elif a < b:
-			return -1
-		elif a > b:
-			return 1
-		# just to be safe, __lt__/ __gt__ above should have thrown
-		# something like this already
-		raise TypeError("Comparison between unorderable types")
diff --git a/pym/gentoolkit/test/test_atom.py b/pym/gentoolkit/test/test_atom.py
index 664bf40..6df52a9 100644
--- a/pym/gentoolkit/test/test_atom.py
+++ b/pym/gentoolkit/test/test_atom.py
@@ -7,7 +7,6 @@ import unittest
 
 from gentoolkit.atom import Atom
 from gentoolkit.cpv import CPV
-from gentoolkit.test import cmp
 
 """Atom test suite (verbatim) from pkgcore."""
 
@@ -17,26 +16,12 @@ class TestGentoolkitAtom(unittest.TestCase):
 		# logic bugs hidden behind short circuiting comparisons for metadata
 		# is why we test the comparison *both* ways.
 		self.assertEqual(o1, o2)
-		c = cmp(o1, o2)
-		self.assertEqual(c, 0,
-			msg="checking cmp for %r, %r, aren't equal: got %i" % (o1, o2, c))
 		self.assertEqual(o2, o1)
-		c = cmp(o2, o1)
-		self.assertEqual(c, 0,
-			msg="checking cmp for %r, %r,aren't equal: got %i" % (o2, o1, c))
 
 	def assertNotEqual2(self, o1, o2):
 		# is why we test the comparison *both* ways.
 		self.assertNotEqual(o1, o2)
-		c = cmp(o1, o2)
-		self.assertNotEqual(c, 0,
-			msg="checking cmp for %r, %r, not supposed to be equal, got %i"
-				% (o1, o2, c))
 		self.assertNotEqual(o2, o1)
-		c = cmp(o2, o1)
-		self.assertNotEqual(c, 0,
-			msg="checking cmp for %r, %r, not supposed to be equal, got %i"
-				% (o2, o1, c))
 
 	def test_comparison(self):
 		self.assertEqual2(Atom('cat/pkg'), Atom('cat/pkg'))
diff --git a/pym/gentoolkit/test/test_cpv.py b/pym/gentoolkit/test/test_cpv.py
index 3817e9f..92ffba5 100644
--- a/pym/gentoolkit/test/test_cpv.py
+++ b/pym/gentoolkit/test/test_cpv.py
@@ -7,7 +7,6 @@
 import unittest
 
 from gentoolkit.cpv import CPV, compare_strs
-from gentoolkit.test import cmp
 
 class TestGentoolkitCPV(unittest.TestCase):
 
@@ -15,26 +14,12 @@ class TestGentoolkitCPV(unittest.TestCase):
 		# logic bugs hidden behind short circuiting comparisons for metadata
 		# is why we test the comparison *both* ways.
 		self.assertEqual(o1, o2)
-		c = cmp(o1, o2)
-		self.assertEqual(c, 0,
-			msg="checking cmp for %r, %r, aren't equal: got %i" % (o1, o2, c))
 		self.assertEqual(o2, o1)
-		c = cmp(o2, o1)
-		self.assertEqual(c, 0,
-			msg="checking cmp for %r, %r,aren't equal: got %i" % (o2, o1, c))
 
 	def assertNotEqual2(self, o1, o2):
 		# is why we test the comparison *both* ways.
 		self.assertNotEqual(o1, o2)
-		c = cmp(o1, o2)
-		self.assertNotEqual(c, 0,
-			msg="checking cmp for %r, %r, not supposed to be equal, got %i"
-				% (o1, o2, c))
 		self.assertNotEqual(o2, o1)
-		c = cmp(o2, o1)
-		self.assertNotEqual(c, 0,
-			msg="checking cmp for %r, %r, not supposed to be equal, got %i"
-				% (o2, o1, c))
 
 	def test_comparison(self):
 		self.assertEqual2(CPV('pkg'), CPV('pkg'))
-- 
2.26.2