public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH gentoolkit] gentoolkit: Remove gentoolkit.test.cmp
@ 2021-01-04 18:22 Matt Turner
  2021-01-10  2:34 ` Zac Medico
  0 siblings, 1 reply; 2+ messages in thread
From: Matt Turner @ 2021-01-04 18:22 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Matt Turner

Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
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



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

* Re: [gentoo-portage-dev] [PATCH gentoolkit] gentoolkit: Remove gentoolkit.test.cmp
  2021-01-04 18:22 [gentoo-portage-dev] [PATCH gentoolkit] gentoolkit: Remove gentoolkit.test.cmp Matt Turner
@ 2021-01-10  2:34 ` Zac Medico
  0 siblings, 0 replies; 2+ messages in thread
From: Zac Medico @ 2021-01-10  2:34 UTC (permalink / raw
  To: gentoo-portage-dev, Matt Turner


[-- Attachment #1.1: Type: text/plain, Size: 483 bytes --]

On 1/4/21 10:22 AM, Matt Turner wrote:
> Signed-off-by: Matt Turner <mattst88@gentoo.org>
> ---
> 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(-)

Looks good.
-- 
Thanks,
Zac


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 981 bytes --]

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

end of thread, other threads:[~2021-01-10  2:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-04 18:22 [gentoo-portage-dev] [PATCH gentoolkit] gentoolkit: Remove gentoolkit.test.cmp Matt Turner
2021-01-10  2:34 ` Zac Medico

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