Remove unused checkout_vendor

Keystone tests don't, and shouldn't, use checkout_vendor, so
remove it and other test functions that it was calling and are
now unused.

Change-Id: I530560d2b7e57278116fab6a4f7df3ea61e757c8
This commit is contained in:
Brant Knudson 2015-03-08 12:50:04 -05:00
parent c3f77c9a57
commit c37ae4e20d
2 changed files with 0 additions and 78 deletions

View File

@ -22,7 +22,6 @@ import re
import shutil
import socket
import sys
import time
import warnings
import fixtures
@ -50,13 +49,11 @@ from keystone.common.kvs import core as kvs_core
from keystone import config
from keystone import controllers
from keystone import exception
from keystone.i18n import _LW
from keystone import notifications
from keystone.policy.backends import rules
from keystone.server import common
from keystone import service
from keystone.tests.unit import ksfixtures
from keystone.tests.unit import utils
config.configure()
@ -116,38 +113,6 @@ class dirs(object):
DEFAULT_TEST_DB_FILE = dirs.tmp('test.db')
def checkout_vendor(repo, rev):
# TODO(termie): this function is a good target for some optimizations :PERF
name = repo.split('/')[-1]
if name.endswith('.git'):
name = name[:-4]
working_dir = os.getcwd()
revdir = os.path.join(VENDOR, '%s-%s' % (name, rev.replace('/', '_')))
modcheck = os.path.join(VENDOR, '.%s-%s' % (name, rev.replace('/', '_')))
try:
if os.path.exists(modcheck):
mtime = os.stat(modcheck).st_mtime
if int(time.time()) - mtime < 10000:
return revdir
if not os.path.exists(revdir):
utils.git('clone', repo, revdir)
os.chdir(revdir)
utils.git('checkout', '-q', 'master')
utils.git('pull', '-q')
utils.git('checkout', '-q', rev)
# write out a modified time
with open(modcheck, 'w') as fd:
fd.write('1')
except environment.subprocess.CalledProcessError:
LOG.warning(_LW('Failed to checkout %s'), repo)
os.chdir(working_dir)
return revdir
@atexit.register
def remove_test_databases():
db = dirs.tmp('test.db')

View File

@ -21,8 +21,6 @@ from oslo_log import log
import six
from testtools import testcase
from keystone.common import environment
LOG = log.getLogger(__name__)
@ -54,47 +52,6 @@ def new_uuid():
return uuid.uuid4().hex
# From python 2.7
def check_output(*popenargs, **kwargs):
r"""Run command with arguments and return its output as a byte string.
If the exit code was non-zero it raises a CalledProcessError. The
CalledProcessError object will have the return code in the returncode
attribute and output in the output attribute.
The arguments are the same as for the Popen constructor. Example:
>>> check_output(['ls', '-l', '/dev/null'])
'crw-rw-rw- 1 root root 1, 3 Oct 18 2007 /dev/null\n'
The stdout argument is not allowed as it is used internally.
To capture standard error in the result, use stderr=STDOUT.
>>> import sys
>>> check_output(['/bin/sh', '-c',
... 'ls -l non_existent_file ; exit 0'],
... stderr=sys.STDOUT)
'ls: non_existent_file: No such file or directory\n'
"""
if 'stdout' in kwargs:
raise ValueError('stdout argument not allowed, it will be overridden.')
LOG.debug(' '.join(popenargs[0]))
process = environment.subprocess.Popen(stdout=environment.subprocess.PIPE,
*popenargs, **kwargs)
output, unused_err = process.communicate()
retcode = process.poll()
if retcode:
cmd = kwargs.get('args')
if cmd is None:
cmd = popenargs[0]
raise environment.subprocess.CalledProcessError(retcode, cmd)
return output
def git(*args):
return check_output(['git'] + list(args))
def wip(message):
"""Mark a test as work in progress.