diff options
author | Dirk Mueller <dirk@dmllr.de> | 2013-04-22 03:42:48 +0200 |
---|---|---|
committer | Dirk Mueller <dirk@dmllr.de> | 2013-04-22 03:42:48 +0200 |
commit | 120ddeff7e1b8956fe35a7a39fae87ddcac8301c (patch) | |
tree | b4eb9b278beca16004e6b1825d8173783390540a /tests/unit | |
parent | 67767b3e8074e4b4a218d7649ef2297c124c342f (diff) | |
download | oslo-120ddeff7e1b8956fe35a7a39fae87ddcac8301c.tar.gz oslo-120ddeff7e1b8956fe35a7a39fae87ddcac8301c.tar.xz oslo-120ddeff7e1b8956fe35a7a39fae87ddcac8301c.zip |
Improve Python 3.x compatibility
Mechanical translation of deprecated constructs
to 3.x compatible variants.
Change-Id: I4988d0ac656903e0d0320aaa8361d4eeb774a0f9
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/rpc/test_common.py | 4 | ||||
-rw-r--r-- | tests/unit/test_excutils.py | 4 | ||||
-rw-r--r-- | tests/unit/test_processutils.py | 2 | ||||
-rw-r--r-- | tests/unit/test_service.py | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/tests/unit/rpc/test_common.py b/tests/unit/rpc/test_common.py index 755e2a4..2248a8f 100644 --- a/tests/unit/rpc/test_common.py +++ b/tests/unit/rpc/test_common.py @@ -213,7 +213,7 @@ class RpcCommonTestCase(test_utils.BaseTestCase): raise ValueError() except Exception: raise rpc_common.ClientException() - except rpc_common.ClientException, e: + except rpc_common.ClientException as e: pass self.assertTrue(isinstance(e, rpc_common.ClientException)) @@ -226,7 +226,7 @@ class RpcCommonTestCase(test_utils.BaseTestCase): e = None try: rpc_common.catch_client_exception([ValueError], naughty, 'a') - except rpc_common.ClientException, e: + except rpc_common.ClientException as e: pass self.assertTrue(isinstance(e, rpc_common.ClientException)) diff --git a/tests/unit/test_excutils.py b/tests/unit/test_excutils.py index d3eeb8c..9d9050e 100644 --- a/tests/unit/test_excutils.py +++ b/tests/unit/test_excutils.py @@ -29,7 +29,7 @@ class SaveAndReraiseTest(utils.BaseTestCase): except: with excutils.save_and_reraise_exception(): pass - except Exception, _e: + except Exception as _e: e = _e self.assertEqual(str(e), msg) @@ -43,7 +43,7 @@ class SaveAndReraiseTest(utils.BaseTestCase): except: with excutils.save_and_reraise_exception(): raise Exception(msg) - except Exception, _e: + except Exception as _e: e = _e self.assertEqual(str(e), msg) diff --git a/tests/unit/test_processutils.py b/tests/unit/test_processutils.py index 689bad0..f096cf7 100644 --- a/tests/unit/test_processutils.py +++ b/tests/unit/test_processutils.py @@ -72,7 +72,7 @@ class ProcessExecutionErrorTest(utils.BaseTestCase): the Wielder of Wonder, with world's renown. """.strip() err = processutils.ProcessExecutionError(stdout=stdout) - print err.message + print(err.message) self.assertTrue('people-kings' in err.message) def test_with_stderr(self): diff --git a/tests/unit/test_service.py b/tests/unit/test_service.py index af6c303..53b7eb4 100644 --- a/tests/unit/test_service.py +++ b/tests/unit/test_service.py @@ -87,7 +87,7 @@ class ServiceLauncherTest(utils.BaseTestCase): try: traceback.print_exc() except BaseException: - print "Couldn't print traceback" + print("Couldn't print traceback") status = 2 # Really exit |