diff options
author | clutton <clutton@zoho.com> | 2016-04-14 22:33:21 +0300 |
---|---|---|
committer | clutton <clutton@zoho.com> | 2016-04-14 22:33:21 +0300 |
commit | 7dfb29db81c7a07bfaefd148258c6a897e8bac1b (patch) | |
tree | fe4ea88adc063545bd34b0dbd124fd1bc769b44c /include_server/basics_test.py | |
parent | 50e5b666d85c92a963ed6c1d4150683e87b8b9a5 (diff) | |
download | distcc-git-python3.tar.gz |
include_server python(3) readypython3
Diffstat (limited to 'include_server/basics_test.py')
-rwxr-xr-x | include_server/basics_test.py | 28 |
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() |