From dcedc4d40147a018cbd39fa5a6d1cac8cf0815b6 Mon Sep 17 00:00:00 2001 From: Ramana Juvvadi Date: Wed, 11 May 2011 08:51:00 -0500 Subject: renamed test_identity.py to test_keystone --- test/unit/test_common.py | 1 - test/unit/test_identity.py | 54 ---------------------------------------------- test/unit/test_keystone.py | 54 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 55 deletions(-) delete mode 100644 test/unit/test_identity.py create mode 100644 test/unit/test_keystone.py (limited to 'test') diff --git a/test/unit/test_common.py b/test/unit/test_common.py index d9bc7b40..6bb86542 100644 --- a/test/unit/test_common.py +++ b/test/unit/test_common.py @@ -258,7 +258,6 @@ def delete_user_xml(tenantid, userid, auth_token): def add_user_tenant_group(tenantid, groupid, userid, auth_token): h = httplib2.Http(".cache") url = '%stenants/%s/groups/%s/users/%s' % (URL, tenantid, groupid, userid) - print url resp, content = h.request(url, "PUT", body='', headers={"Content-Type": "application/json", diff --git a/test/unit/test_identity.py b/test/unit/test_identity.py deleted file mode 100644 index 31b6ae32..00000000 --- a/test/unit/test_identity.py +++ /dev/null @@ -1,54 +0,0 @@ -#TODO (India Team) Need to modify this script -import logging -import os -import unittest - -MODULE_EXTENSIONS = set('.py .pyc .pyo'.split()) - -def unit_test_extractor(tup, path, filenames): - """Pull ``unittest.TestSuite``s from modules in path - if the path represents a valid Python package. Accumulate - results in `tup[1]`. - """ - package_path, suites = tup - logging.debug('Path: %s', path) - logging.debug('Filenames: %s', filenames) - relpath = os.path.relpath(path, package_path) - relpath_pieces = relpath.split(os.sep) - - if relpath_pieces[0] == '.': # Base directory. - relpath_pieces.pop(0) # Otherwise, screws up module name. - elif not any(os.path.exists(os.path.join(path, '__init__' + ext)) - for ext in MODULE_EXTENSIONS): - return # Not a package directory and not the base directory, reject. - - logging.info('Base: %s', '.'.join(relpath_pieces)) - for filename in filenames: - base, ext = os.path.splitext(filename) - if ext not in MODULE_EXTENSIONS: # Not a Python module. - continue - logging.info('Module: %s', base) - module_name = '.'.join(relpath_pieces + [base]) - logging.info('Importing from %s', module_name) - module = __import__(module_name) - module_suites = unittest.defaultTestLoader.loadTestsFromModule(module) - logging.info('Got suites: %s', module_suites) - suites += module_suites - -def get_test_suites(path): - """:return: Iterable of suites for the packages/modules - present under :param:`path`. - """ - logging.info('Base path: %s', package_path) - suites = [] - os.path.walk(package_path, unit_test_extractor, (package_path, suites)) - logging.info('Got suites: %s', suites) - return suites - -if __name__ == '__main__': - logging.basicConfig(level=logging.WARN) - package_path = os.path.dirname(os.path.abspath(__file__)) - suites = get_test_suites(package_path) - for suite in suites: - unittest.TextTestRunner(verbosity=2).run(suite) - diff --git a/test/unit/test_keystone.py b/test/unit/test_keystone.py new file mode 100644 index 00000000..31b6ae32 --- /dev/null +++ b/test/unit/test_keystone.py @@ -0,0 +1,54 @@ +#TODO (India Team) Need to modify this script +import logging +import os +import unittest + +MODULE_EXTENSIONS = set('.py .pyc .pyo'.split()) + +def unit_test_extractor(tup, path, filenames): + """Pull ``unittest.TestSuite``s from modules in path + if the path represents a valid Python package. Accumulate + results in `tup[1]`. + """ + package_path, suites = tup + logging.debug('Path: %s', path) + logging.debug('Filenames: %s', filenames) + relpath = os.path.relpath(path, package_path) + relpath_pieces = relpath.split(os.sep) + + if relpath_pieces[0] == '.': # Base directory. + relpath_pieces.pop(0) # Otherwise, screws up module name. + elif not any(os.path.exists(os.path.join(path, '__init__' + ext)) + for ext in MODULE_EXTENSIONS): + return # Not a package directory and not the base directory, reject. + + logging.info('Base: %s', '.'.join(relpath_pieces)) + for filename in filenames: + base, ext = os.path.splitext(filename) + if ext not in MODULE_EXTENSIONS: # Not a Python module. + continue + logging.info('Module: %s', base) + module_name = '.'.join(relpath_pieces + [base]) + logging.info('Importing from %s', module_name) + module = __import__(module_name) + module_suites = unittest.defaultTestLoader.loadTestsFromModule(module) + logging.info('Got suites: %s', module_suites) + suites += module_suites + +def get_test_suites(path): + """:return: Iterable of suites for the packages/modules + present under :param:`path`. + """ + logging.info('Base path: %s', package_path) + suites = [] + os.path.walk(package_path, unit_test_extractor, (package_path, suites)) + logging.info('Got suites: %s', suites) + return suites + +if __name__ == '__main__': + logging.basicConfig(level=logging.WARN) + package_path = os.path.dirname(os.path.abspath(__file__)) + suites = get_test_suites(package_path) + for suite in suites: + unittest.TextTestRunner(verbosity=2).run(suite) + -- cgit