17 Commits

Author SHA1 Message Date
Arata Notsu
61e53b003d Correct execute() to check 0 in check_exit_code
This patch fixes: if a process exits with returncode 0, the function
always returns without raising an exception, regardless of whether
its check_exit_code includes 0 or not.

Change-Id: Ibdf7599dd91949153629083e4c5a47d263d6d002
2013-10-25 13:01:49 +09:00
Zhongyue Luo
e8269ab1aa Replace assertEquals with assertEqual
The method assertEquals has been deprecated since python 2.7.
http://docs.python.org/2/library/unittest.html#deprecated-aliases

Also in Python 3, a deprecated warning is raised when using assertEquals.

Change-Id: I667e41df786c842ecffc6920b80319fd8b3487a3
2013-10-23 16:18:27 +08:00
Zhongyue Luo
bdfdf7bbd2 Bump hacking to 0.7.0
Fixes H202, H602 errors

Change-Id: Ic3045f15116d1d7a28b63bc94a0a341b9304ffdd
2013-08-17 02:34:58 +09:00
Alexander Gorodnev
da0f0d7fd8 Replace using tests.utils with openstack.common.test
It is the first step to replace using tests.utils with openstack.common.test.
All these tests don't use mock objects, stubs, config files and use only
BaseTestCase class.

Change-Id: I511816b5c9e6c5c34ebff199296ee4fc8b84c672
bp: common-unit-tests
2013-08-09 05:34:55 -04:00
Johannes Erdfelt
d1eab10aa5 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
2013-07-26 20:20:25 +00:00
Ann Kamyshnikova
9329d4c7c0 Enable H302 hacking check
This change requires hacking >0.5.5

Change-Id: Ic36fa0502548335d433f3fbe663854523dd04397
2013-07-10 11:12:25 +04:00
Dirk Mueller
cf511958ac Use Python 3.x compatible octal literal notation
0o755 is accepted by Python 2.6 and newer (did not
check older versions)

Change-Id: I764fb56f8ae26c63981a96e1d988d6da37e1bd02
2013-06-08 15:06:56 +02:00
Chuck Short
0a078f1a1e python3: python3 binary/text data compatbility
Python3 enforces the distinction between byte strings
far more rigorously than Python 2 does; binary data
cannot be automatically coerced to or from text data.

Use six to provide a fake file object for textual data.
It provides an alias for StringIO.StringIO in python2
and io.StringIO in python3

Change-Id: I65897bb0cca2cbeb5819a769b98645c9eb066401
Signed-off-by: Chuck Short <chuck.short@canonical.com>
2013-05-31 12:17:38 -05:00
Michael Still
be982c56ee Import trycmd and ssh_execute from nova.
This change required adding basic unit tests as well as these were
both untested in nova.

Change-Id: If6843e57810198aab3c61f9eb3c3a6f42f710f7c
2013-05-07 08:36:33 +10:00
Michael Still
ff90c4076e Update processutils.
This is another example of something which was imported from nova
but where nova was never moved across to use the oslo version. The
code has since diverged. This review syncs up the two versions,
and will be followed by a nova review to move nova across to the
oslo implementation.

Unit test coverage for this new version is 83%. I want to improve
that, but I'll do it in a later review.

I will also need to update cinder, quantum and nova to this new
version of the code once this merges. I will do moniker as well
because I am a nice guy.

Change-Id: Ie0731c56c9aab547b5d5b905bf4ed8eff3eae3bd
2013-05-03 10:42:59 +10:00
Mark McLoughlin
51896514a7 Use print_function __future__ import
Rather than continuing to use the old print statement, use the actual
print function introduced in python 2.6. See:

  http://docs.python.org/2/whatsnew/2.6.html#pep-3105-print-as-a-function

Change-Id: I059d982d60e13f13e1caf49509c0fe0b18eda723
2013-04-22 14:55:51 +01:00
Dirk Mueller
57ca88bb6e Improve Python 3.x compatibility
Mechanical translation of deprecated constructs
to 3.x compatible variants.

Change-Id: I4988d0ac656903e0d0320aaa8361d4eeb774a0f9
2013-04-22 03:42:48 +02:00
Zhongyue Luo
2fbb82b14b Removes unused imports in the tests module
Fixes bug #1157596

Change-Id: I36d5484eaa2f0e21188eed6e70cc1ad785233d6a
2013-03-20 16:24:31 +08:00
Davanum Srinivas
1f52426f91 Fix Copyright Headers - Rename LLC to Foundation
One code change, rest are in headers

Change-Id: I73f59681358629e1ad74e49d3d3ca13fcb5c2eb1
2013-03-11 14:49:31 -04:00
Monty Taylor
2670fa0557 Replace direct use of testtools BaseTestCase.
Using the BaseTestCase across the tests in the tree lets us put in log
fixtures and consistently handle mox and stubout.

Part of blueprint grizzly-testtools.

Change-Id: Iba7eb2c63b0c514009b2c28e5930b27726a147b0
2013-01-24 16:30:26 +11:00
Monty Taylor
72cadd4f38 Use testtools as test base class.
On the path to testr migration, we need to replace the unittest base classes
with testtools.
Replace tearDown with addCleanup, addCleanup is more resilient than tearDown.
The fixtures library has excellent support for managing and cleaning
tempfiles. Use it.
Replace skip_ with testtools.skipTest

Part of blueprint grizzly-testtools.

Change-Id: I45e11bbb1ff9b31f3278d3b016737dcb7850cd98
2013-01-24 16:26:43 +11:00
Michael Still
bdfffca2cb Move utils.execute to its own module.
Also move the exceptions raised to being local to the executils
module.

Change-Id: Ibb2445f92840b9ce4b52373b0b09adb3d6a4a897
2012-11-01 15:00:55 +01:00