Skip to content

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. Use the subprocess module instead.
See http://docs.python.org/2/library/commands#module-commands

Closes-Bug: #1248216
Change-Id: I0a89dbba374a28b16a6e24f2a1b05ce06e044de4
  • Loading branch information
glongwave committed Nov 22, 2013
1 parent e6be4ac commit 21510b1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions glance/tests/unit/test_migrations.py
Expand Up @@ -27,12 +27,12 @@

from __future__ import print_function

import commands
import ConfigParser
import datetime
import json
import os
import pickle
import subprocess
import urlparse

from migrate.versioning.repository import Repository
Expand Down Expand Up @@ -166,9 +166,12 @@ def tearDown(self):

def _reset_databases(self):
def execute_cmd(cmd=None):
status, output = commands.getstatusoutput(cmd)
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, shell=True)
output = proc.communicate()[0]
LOG.debug(output)
self.assertEqual(0, status)
self.assertEqual(0, proc.returncode)

for key, engine in self.engines.items():
conn_string = self.test_databases[key]
conn_pieces = urlparse.urlparse(conn_string)
Expand Down

0 comments on commit 21510b1

Please sign in to comment.