summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLumir Balhar <lbalhar@redhat.com>2017-01-18 11:38:55 +0100
committerAndrew Bartlett <abartlet@samba.org>2017-03-10 07:31:11 +0100
commit9843ccef878ba473db68dbbd2a6b89d5a3369f88 (patch)
treed6a9b3176849e068cb647d6411c3f026f9bf55fa
parent3b1c0ba98a8497172d2124e8555e1c504781b8f9 (diff)
downloadsamba-9843ccef878ba473db68dbbd2a6b89d5a3369f88.tar.gz
python: samba.tests.dcerpc.misc: Port and enable tests
Port tests of samba.dcerpc.misc module to Python 3 compatible form and enable their execution with Python 3. Signed-off-by: Lumir Balhar <lbalhar@redhat.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
-rw-r--r--python/samba/tests/dcerpc/misc.py11
-rw-r--r--selftest/tests.py2
2 files changed, 10 insertions, 3 deletions
diff --git a/python/samba/tests/dcerpc/misc.py b/python/samba/tests/dcerpc/misc.py
index 11e14aadfa7..7cdb0048148 100644
--- a/python/samba/tests/dcerpc/misc.py
+++ b/python/samba/tests/dcerpc/misc.py
@@ -19,6 +19,7 @@
from samba.dcerpc import misc
import samba.tests
+from samba.compat import PY3
text1 = "76f53846-a7c2-476a-ae2c-20e2b80d7b34"
text2 = "344edffa-330a-4b39-b96e-2c34da52e8b1"
@@ -36,13 +37,19 @@ class GUIDTests(samba.tests.TestCase):
def test_compare_different(self):
guid1 = misc.GUID(text1)
guid2 = misc.GUID(text2)
- self.assertTrue(cmp(guid1, guid2) > 0)
+ self.assertFalse(guid1 == guid2)
+ if not PY3:
+ # cmp() exists only in Python 2
+ self.assertTrue(cmp(guid1, guid2) > 0)
def test_compare_same(self):
guid1 = misc.GUID(text1)
guid2 = misc.GUID(text1)
- self.assertEquals(0, cmp(guid1, guid2))
+ self.assertTrue(guid1 == guid2)
self.assertEquals(guid1, guid2)
+ if not PY3:
+ # cmp() exists only in Python 2
+ self.assertEquals(0, cmp(guid1, guid2))
class PolicyHandleTests(samba.tests.TestCase):
diff --git a/selftest/tests.py b/selftest/tests.py
index 77a17a0279e..150948325b3 100644
--- a/selftest/tests.py
+++ b/selftest/tests.py
@@ -57,7 +57,7 @@ planpythontestsuite("none", "samba.tests.registry")
planpythontestsuite("none", "samba.tests.auth")
planpythontestsuite("none", "samba.tests.get_opt")
planpythontestsuite("none", "samba.tests.security")
-planpythontestsuite("none", "samba.tests.dcerpc.misc")
+planpythontestsuite("none", "samba.tests.dcerpc.misc", py3_compatible=True)
planpythontestsuite("none", "samba.tests.dcerpc.integer")
planpythontestsuite("none", "samba.tests.param", py3_compatible=True)
planpythontestsuite("none", "samba.tests.upgrade")