Gentoo Archives: gentoo-portage-dev

From: Matt Turner <mattst88@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Matt Turner <mattst88@g.o>
Subject: [gentoo-portage-dev] [PATCH gentoolkit] gentoolkit: Remove gentoolkit.test.cmp
Date: Mon, 04 Jan 2021 18:22:17
Message-Id: 20210104182210.417576-1-mattst88@gentoo.org
1 Signed-off-by: Matt Turner <mattst88@g.o>
2 ---
3 Seems to only be used by duplicated unit tests? I guess this might have
4 been useful when Python 2 was still supported?
5
6 pym/gentoolkit/test/__init__.py | 23 -----------------------
7 pym/gentoolkit/test/test_atom.py | 15 ---------------
8 pym/gentoolkit/test/test_cpv.py | 15 ---------------
9 3 files changed, 53 deletions(-)
10
11 diff --git a/pym/gentoolkit/test/__init__.py b/pym/gentoolkit/test/__init__.py
12 index 9e41686..e69de29 100644
13 --- a/pym/gentoolkit/test/__init__.py
14 +++ b/pym/gentoolkit/test/__init__.py
15 @@ -1,23 +0,0 @@
16 -#!/usr/bin/python
17 -# Copyright 2009 Gentoo Foundation
18 -#
19 -# Distributed under the terms of the GNU General Public License v2
20 -
21 -__all__ = ['cmp']
22 -
23 -# py3k doesn't have cmp emulate it in order to keep testing cmp
24 -# in python-2.x
25 -#XXX: not sure if this is the best place for this
26 -try:
27 - cmp = cmp
28 -except NameError:
29 - def cmp(a, b):
30 - if a == b:
31 - return 0
32 - elif a < b:
33 - return -1
34 - elif a > b:
35 - return 1
36 - # just to be safe, __lt__/ __gt__ above should have thrown
37 - # something like this already
38 - raise TypeError("Comparison between unorderable types")
39 diff --git a/pym/gentoolkit/test/test_atom.py b/pym/gentoolkit/test/test_atom.py
40 index 664bf40..6df52a9 100644
41 --- a/pym/gentoolkit/test/test_atom.py
42 +++ b/pym/gentoolkit/test/test_atom.py
43 @@ -7,7 +7,6 @@ import unittest
44
45 from gentoolkit.atom import Atom
46 from gentoolkit.cpv import CPV
47 -from gentoolkit.test import cmp
48
49 """Atom test suite (verbatim) from pkgcore."""
50
51 @@ -17,26 +16,12 @@ class TestGentoolkitAtom(unittest.TestCase):
52 # logic bugs hidden behind short circuiting comparisons for metadata
53 # is why we test the comparison *both* ways.
54 self.assertEqual(o1, o2)
55 - c = cmp(o1, o2)
56 - self.assertEqual(c, 0,
57 - msg="checking cmp for %r, %r, aren't equal: got %i" % (o1, o2, c))
58 self.assertEqual(o2, o1)
59 - c = cmp(o2, o1)
60 - self.assertEqual(c, 0,
61 - msg="checking cmp for %r, %r,aren't equal: got %i" % (o2, o1, c))
62
63 def assertNotEqual2(self, o1, o2):
64 # is why we test the comparison *both* ways.
65 self.assertNotEqual(o1, o2)
66 - c = cmp(o1, o2)
67 - self.assertNotEqual(c, 0,
68 - msg="checking cmp for %r, %r, not supposed to be equal, got %i"
69 - % (o1, o2, c))
70 self.assertNotEqual(o2, o1)
71 - c = cmp(o2, o1)
72 - self.assertNotEqual(c, 0,
73 - msg="checking cmp for %r, %r, not supposed to be equal, got %i"
74 - % (o2, o1, c))
75
76 def test_comparison(self):
77 self.assertEqual2(Atom('cat/pkg'), Atom('cat/pkg'))
78 diff --git a/pym/gentoolkit/test/test_cpv.py b/pym/gentoolkit/test/test_cpv.py
79 index 3817e9f..92ffba5 100644
80 --- a/pym/gentoolkit/test/test_cpv.py
81 +++ b/pym/gentoolkit/test/test_cpv.py
82 @@ -7,7 +7,6 @@
83 import unittest
84
85 from gentoolkit.cpv import CPV, compare_strs
86 -from gentoolkit.test import cmp
87
88 class TestGentoolkitCPV(unittest.TestCase):
89
90 @@ -15,26 +14,12 @@ class TestGentoolkitCPV(unittest.TestCase):
91 # logic bugs hidden behind short circuiting comparisons for metadata
92 # is why we test the comparison *both* ways.
93 self.assertEqual(o1, o2)
94 - c = cmp(o1, o2)
95 - self.assertEqual(c, 0,
96 - msg="checking cmp for %r, %r, aren't equal: got %i" % (o1, o2, c))
97 self.assertEqual(o2, o1)
98 - c = cmp(o2, o1)
99 - self.assertEqual(c, 0,
100 - msg="checking cmp for %r, %r,aren't equal: got %i" % (o2, o1, c))
101
102 def assertNotEqual2(self, o1, o2):
103 # is why we test the comparison *both* ways.
104 self.assertNotEqual(o1, o2)
105 - c = cmp(o1, o2)
106 - self.assertNotEqual(c, 0,
107 - msg="checking cmp for %r, %r, not supposed to be equal, got %i"
108 - % (o1, o2, c))
109 self.assertNotEqual(o2, o1)
110 - c = cmp(o2, o1)
111 - self.assertNotEqual(c, 0,
112 - msg="checking cmp for %r, %r, not supposed to be equal, got %i"
113 - % (o2, o1, c))
114
115 def test_comparison(self):
116 self.assertEqual2(CPV('pkg'), CPV('pkg'))
117 --
118 2.26.2

Replies