selftest: enable py3 for samba.tests.upgrade
authorJoe Guo <joeg@catalyst.net.nz>
Tue, 3 Apr 2018 02:29:26 +0000 (14:29 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 5 Apr 2018 06:59:09 +0000 (08:59 +0200)
`os.tempname` is removed in Python 3.
Use `tempfile` instead.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
python/samba/tests/__init__.py
selftest/tests.py

index 935a0873303571f2c3207aaf51498a06f31b1cd0..bc8c185769b8fe76b8bf3149316f15c3df23ae74 100644 (file)
@@ -19,6 +19,7 @@
 """Samba Python tests."""
 
 import os
+import tempfile
 import ldb
 import samba
 from samba import param
@@ -254,7 +255,8 @@ class LdbTestCase(TestCase):
 
     def setUp(self):
         super(LdbTestCase, self).setUp()
-        self.filename = os.tempnam()
+        self.tempfile = tempfile.NamedTemporaryFile(delete=False)
+        self.filename = self.tempfile.name
         self.ldb = samba.Ldb(self.filename)
 
     def set_modules(self, modules=[]):
index 4cb6e23446c35ba4eb4c65330ac2fb04d052f120..55c3d0f59f492b32ef7adb4a9e1d114cd93c79ba 100644 (file)
@@ -62,7 +62,7 @@ planpythontestsuite("none", "samba.tests.security", py3_compatible=True)
 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")
+planpythontestsuite("none", "samba.tests.upgrade", py3_compatible=True)
 planpythontestsuite("none", "samba.tests.core", py3_compatible=True)
 planpythontestsuite("none", "samba.tests.common")
 planpythontestsuite("none", "samba.tests.provision", py3_compatible=True)