summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJohannes Erdfelt <johannes.erdfelt@rackspace.com>2013-07-26 15:16:13 +0000
committerJohannes Erdfelt <johannes.erdfelt@rackspace.com>2013-07-26 20:20:25 +0000
commitdf3f2bafbe76d78d017d40e7dc08909fee7dbe34 (patch)
tree839406bbf4f76adb436ff04162b459a6b916273b /tests
parentd4d81262ff74ff54e51db4065192fd9a0119ec34 (diff)
downloadoslo-df3f2bafbe76d78d017d40e7dc08909fee7dbe34.tar.gz
oslo-df3f2bafbe76d78d017d40e7dc08909fee7dbe34.tar.xz
oslo-df3f2bafbe76d78d017d40e7dc08909fee7dbe34.zip
BaseException.message is deprecated since Python 2.6
PEP 352 deprecated the message attribute of the BaseException class. Using the message attribute will result in warnings like this: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6 Using unicode(exc) is the suggested replacement. Change-Id: Ibf3c56e4baa6ad83e2b95a948787e9d02cf074d4
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test_processutils.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/unit/test_processutils.py b/tests/unit/test_processutils.py
index 7c6e11c..8a14eaf 100644
--- a/tests/unit/test_processutils.py
+++ b/tests/unit/test_processutils.py
@@ -41,23 +41,23 @@ class ProcessExecutionErrorTest(utils.BaseTestCase):
def test_defaults(self):
err = processutils.ProcessExecutionError()
- self.assertTrue('None\n' in err.message)
- self.assertTrue('code: -\n' in err.message)
+ self.assertTrue('None\n' in unicode(err))
+ self.assertTrue('code: -\n' in unicode(err))
def test_with_description(self):
description = 'The Narwhal Bacons at Midnight'
err = processutils.ProcessExecutionError(description=description)
- self.assertTrue(description in err.message)
+ self.assertTrue(description in unicode(err))
def test_with_exit_code(self):
exit_code = 0
err = processutils.ProcessExecutionError(exit_code=exit_code)
- self.assertTrue(str(exit_code) in err.message)
+ self.assertTrue(str(exit_code) in unicode(err))
def test_with_cmd(self):
cmd = 'telinit'
err = processutils.ProcessExecutionError(cmd=cmd)
- self.assertTrue(cmd in err.message)
+ self.assertTrue(cmd in unicode(err))
def test_with_stdout(self):
stdout = """
@@ -80,13 +80,13 @@ class ProcessExecutionErrorTest(utils.BaseTestCase):
the Wielder of Wonder, with world's renown.
""".strip()
err = processutils.ProcessExecutionError(stdout=stdout)
- print(err.message)
- self.assertTrue('people-kings' in err.message)
+ print(unicode(err))
+ self.assertTrue('people-kings' in unicode(err))
def test_with_stderr(self):
stderr = 'Cottonian library'
err = processutils.ProcessExecutionError(stderr=stderr)
- self.assertTrue(stderr in str(err.message))
+ self.assertTrue(stderr in unicode(err))
def test_retry_on_failure(self):
fd, tmpfilename = tempfile.mkstemp()