python: Port tests of samba.messaging to Python 3 compatible form.
authorLumir Balhar <lbalhar@redhat.com>
Thu, 14 Sep 2017 07:31:17 +0000 (09:31 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Mon, 23 Oct 2017 13:40:48 +0000 (15:40 +0200)
Signed-off-by: Lumir Balhar <lbalhar@redhat.com>
Reviewed-by: Andrew Bartlet <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Oct 23 15:40:48 CEST 2017 on sn-devel-144

python/samba/compat.py
python/samba/tests/messaging.py
selftest/tests.py

index c8215f3f6af8cdbf3dd2516be5996d22aea4e27f..dfdfb7dd81ee6c789a9fc3d19e38502d8d719f9f 100644 (file)
@@ -20,3 +20,8 @@
 import sys
 
 PY3 = sys.version_info[0] == 3
+
+if PY3:
+    integer_types = int,
+else:
+    integer_types = (int, long)
index 41834c1a110cee26ec0bd02153cf17f5880b6316..2a3685fee29af100efaf22f7d90fa6c6e5f0b8bc 100644 (file)
@@ -26,6 +26,8 @@ from samba.ndr import ndr_print
 from samba.dcerpc import server_id
 import random
 import os
+from samba.compat import integer_types
+
 
 class MessagingTests(TestCase):
 
@@ -38,7 +40,7 @@ class MessagingTests(TestCase):
         def callback():
             pass
         msg_type = x.register((callback, None))
-        self.assertTrue(isinstance(msg_type, long))
+        self.assertTrue(isinstance(msg_type, integer_types))
         x.deregister(callback, msg_type)
 
     def test_all_servers(self):
index 639bc63649dc8b3a5c4aeb0412ae5146cbf2eebb..704dbad3b73f094606f621e90322a088d34168b8 100644 (file)
@@ -73,7 +73,8 @@ planpythontestsuite("none", "samba.tests.dcerpc.rpc_talloc")
 planpythontestsuite("none", "samba.tests.dcerpc.array")
 planpythontestsuite("none", "samba.tests.dcerpc.string")
 planpythontestsuite("none", "samba.tests.hostconfig")
-planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.messaging")
+planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.messaging",
+                    py3_compatible=True)
 planpythontestsuite("none", "samba.tests.samba3sam")
 planpythontestsuite(
     "none", "wafsamba.tests.test_suite",