summaryrefslogtreecommitdiff
path: root/include_server/basics_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'include_server/basics_test.py')
-rwxr-xr-xinclude_server/basics_test.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/include_server/basics_test.py b/include_server/basics_test.py
index 02d4f75..ab8dfdc 100755
--- a/include_server/basics_test.py
+++ b/include_server/basics_test.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python2.4
+#! /usr/bin/env python3
# Copyright 2007 Google Inc.
#
@@ -46,7 +46,7 @@ class BasicsTest(unittest.TestCase):
os_makedirs = os.makedirs
def Mock_tempfile_mkdtemp(pat, dir):
- self.assert_((pat, dir)
+ self.assertTrue((pat, dir)
in
[('.%s-%s-%d' %
(basics.ClientRootKeeper.INCLUDE_SERVER_NAME,
@@ -56,15 +56,15 @@ class BasicsTest(unittest.TestCase):
[(1,'/to/be'), (2, '/to')]])
return (dir == '/to/be' and '/to/be/xxxxxx'
or dir == '/to' and '/to/xxxxxxx')
-
+
def Mock_os_makedirs(f, *unused_args):
if not f.startswith('/to/'):
- raise Exception, f
-
+ raise Exception(f)
+
tempfile.mkdtemp = Mock_tempfile_mkdtemp
os.makedirs = Mock_os_makedirs
-
+
os.environ['DISTCC_CLIENT_TMP'] = '/to/be'
client_root_keeper = basics.ClientRootKeeper()
client_root_keeper.ClientRootMakedir(1)
@@ -91,13 +91,13 @@ class BasicsTest(unittest.TestCase):
os.environ['DISTCC_CLIENT_TMP'] = '/tmp'
client_root_keeper = basics.ClientRootKeeper()
client_root_keeper.ClientRootMakedir(117)
- self.assert_(os.path.isdir(client_root_keeper._client_root_before_padding))
- self.assert_(os.path.isdir(client_root_keeper.client_root))
- self.assert_(client_root_keeper.client_root.endswith('/padding'))
+ self.assertTrue(os.path.isdir(client_root_keeper._client_root_before_padding))
+ self.assertTrue(os.path.isdir(client_root_keeper.client_root))
+ self.assertTrue(client_root_keeper.client_root.endswith('/padding'))
client_root_keeper.ClientRootMakedir(118)
client_root_keeper.CleanOutClientRoots()
# Directories must be gone now!
- self.assert_(not os.path.isdir(
+ self.assertTrue(not os.path.isdir(
client_root_keeper._client_root_before_padding))
# Test with a two-level value of DISTCC_CLIENT_TMP.
try:
@@ -105,14 +105,14 @@ class BasicsTest(unittest.TestCase):
dir='/tmp')
client_root_keeper = basics.ClientRootKeeper()
client_root_keeper.ClientRootMakedir(117)
- self.assert_(os.path.isdir(
+ self.assertTrue(os.path.isdir(
client_root_keeper._client_root_before_padding))
- self.assert_(os.path.isdir(client_root_keeper.client_root))
+ self.assertTrue(os.path.isdir(client_root_keeper.client_root))
client_root_keeper.ClientRootMakedir(118)
client_root_keeper.CleanOutClientRoots()
- self.assert_(os.path.isdir,
+ self.assertTrue(os.path.isdir,
client_root_keeper._client_root_before_padding)
finally:
os.rmdir(os.environ['DISTCC_CLIENT_TMP'])
-unittest.main()
+unittest.main()