Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Don't use deprecated module commands
Browse files Browse the repository at this point in the history
The commands module was deprecated since version 2.6 and it has been
removed in Python 3. This patch uses processutils.trycmd method to
replace of deprecated module commands.
See http://docs.python.org/2/library/commands#module-commands

Closes-Bug: #1248216

Change-Id: Iee0b3cf59c738bfda9c5b2049a1853abbb6d16e0
  • Loading branch information
glongwave committed Nov 20, 2013
1 parent 44e8222 commit ca7a2ab
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions openstack/common/db/sqlalchemy/test_migrations.py
Expand Up @@ -16,8 +16,6 @@
# License for the specific language governing permissions and limitations
# under the License.


import commands
import ConfigParser
import os
import urlparse
Expand All @@ -27,6 +25,7 @@

from openstack.common import lockutils
from openstack.common import log as logging
from openstack.common import processutils
from openstack.common import test

LOG = logging.getLogger(__name__)
Expand Down Expand Up @@ -143,9 +142,10 @@ def tearDown(self):
super(BaseMigrationTestCase, self).tearDown()

def execute_cmd(self, cmd=None):
status, output = commands.getstatusoutput(cmd)
out, err = processutils.trycmd(cmd, shell=True, discard_warnings=True)
output = out or err
LOG.debug(output)
self.assertEqual(0, status,
self.assertEqual('', err,
"Failed to run: %s\n%s" % (cmd, output))

@lockutils.synchronized('pgadmin', 'tests-', external=True)
Expand Down

0 comments on commit ca7a2ab

Please sign in to comment.