def run_tests(): # Build module list and run tests import sys ut.change_term_title('RUN HESAFF TESTS') exclude_doctests_fnames = set([ ]) exclude_dirs = [ '_broken', 'old', #'tests', 'timeits', '_scripts', '_timeits', '_doc', 'notebook', ] dpath_list = ['pyhesaff'] doctest_modname_list = ut.find_doctestable_modnames( dpath_list, exclude_doctests_fnames, exclude_dirs) #print(doctest_modname_list) #return for modname in doctest_modname_list: exec('import ' + modname, globals(), locals()) module_list = [sys.modules[name] for name in doctest_modname_list] ut.doctest_module_list(module_list)
def run_tests(): # Build module list and run tests import sys ut.change_term_title('RUN IBEIS_CNN TESTS') exclude_doctests_fnames = set([]) exclude_dirs = [ '_broken', #'old', #'tests', #'timeits', #'_scripts', #'_timeits', #'_doc', #'notebook', ] dpath_list = ['ibeis_cnn'] doctest_modname_list = ut.find_doctestable_modnames( dpath_list, exclude_doctests_fnames, exclude_dirs) for modname in doctest_modname_list: exec('import ' + modname, globals(), locals()) module_list = [sys.modules[name] for name in doctest_modname_list] nPass, nTotal, failed_cmd_list = ut.doctest_module_list(module_list) if nPass != nTotal: return 1 else: return 0
def run_tests(): # Build module list and run tests import sys ut.change_term_title('RUN PLOTTOOL TESTS') exclude_doctests_fnames = set([ ]) exclude_dirs = [ '_broken', 'old', 'tests', 'timeits', '_scripts', '_timeits', '_doc', 'notebook', ] dpath_list = ['plottool'] doctest_modname_list = ut.find_doctestable_modnames( dpath_list, exclude_doctests_fnames, exclude_dirs) for modname in doctest_modname_list: exec('import ' + modname, globals()) module_list = [sys.modules[name] for name in doctest_modname_list] nPass, nTotal, failed_cmd_list = ut.doctest_module_list(module_list) if nPass != nTotal: return 1 else: return 0
def run_tests(): # Build module list and run tests import sys ut.change_term_title('RUN sandbox_utools TESTS') exclude_doctests_fnames = set([ ]) exclude_dirs = [ '_broken', 'old', 'tests', 'timeits', '_scripts', '_timeits', '_doc', 'notebook', ] dpath_list = ['sandbox_utools'] doctest_modname_list = ut.find_doctestable_modnames( dpath_list, exclude_doctests_fnames, exclude_dirs) coverage = ut.get_argflag(('--coverage', '--cov',)) if coverage: import coverage cov = coverage.Coverage(source=doctest_modname_list) cov.start() print('Starting coverage') exclude_lines = [ 'pragma: no cover', 'def __repr__', 'if self.debug:', 'if settings.DEBUG', 'raise AssertionError', 'raise NotImplementedError', 'if 0:', 'if ut.VERBOSE', 'if _debug:', 'if __name__ == .__main__.:', 'print(.*)', ] for line in exclude_lines: cov.exclude(line) for modname in doctest_modname_list: exec('import ' + modname, globals()) module_list = [sys.modules[name] for name in doctest_modname_list] nPass, nTotal, failed_cmd_list = ut.doctest_module_list(module_list) if coverage: print('Stoping coverage') cov.stop() print('Saving coverage') cov.save() print('Generating coverage html report') cov.html_report() if nPass != nTotal: return 1 else: return 0
def ensure_testing_data(): from ibeis.tests import reset_testdbs print('Making sure test data exists') import ibeis from os.path import join ut.change_term_title('ENSURE IBEIS TETSDATA') reset_testdbs.reset_testdbs() workdir = ibeis.get_workdir() if not ut.checkpath(join(workdir, 'PZ_MTEST')): ibeis.ensure_pz_mtest() if not ut.checkpath(join(workdir, 'NAUT_test')): ibeis.ensure_nauts() if not ut.checkpath(join(workdir, 'wd_peter2')): ibeis.ensure_wilddogs()
def rsync_ibsdb_main(): import sys default_user = ut.get_user_name() default_db = 'MUGU_Master' if len(sys.argv) < 2: print('Usage: ' 'python -m ibeis.scripts.rsync_ibeisdb' '[push, pull] --db <db=%s> --user <user=%s>' % (default_db, default_user,)) sys.exit(1) user = ut.get_argval('--user', type_=str, default=default_user) port = ut.get_argval('--port', type_=int, default=22) dbname = ut.get_argval(('--db', '--dbname'), type_=str, default=default_db) workdir = ut.get_argval(('--workdir', '--dbname'), type_=str, default=None, help_='local work dir override') dry_run = ut.get_argflag(('--dryrun', '--dry-run', '--dry')) mode = sys.argv[1] assert mode in ['push', 'pull'], 'mode=%r must be push or pull' % (mode,) remote_key = ut.get_argval('--remote', type_=str, default='hyrule') remote_map = { 'hyrule': 'hyrule.cs.rpi.edu', 'pachy': 'pachy.cs.uic.edu', 'lewa': '41.203.223.178', 'lev': 'lev.cs.rpi.edu', } remote_workdir_map = { 'hyrule': '/raid/work', 'pachy': '/home/shared_ibeis/data/work', 'lewa': '/data/ibeis', 'lev': '/media/hdd/work', } if ':' in remote_key: remote_key_, remote_workdir = remote_key.split(':') else: remote_key_ = remote_key remote_workdir = remote_workdir_map.get(remote_key, '') remote = remote_map.get(remote_key_, remote_key_) remote_uri = user + '@' + remote + ':' + remote_workdir ut.change_term_title('RSYNC IBEISDB %r' % (dbname,)) sync_ibeisdb(remote_uri, dbname, mode, workdir, port, dry_run)
def run_tests(): # Build module list and run tests import sys ut.change_term_title('RUN CURVRANK TESTS') exclude_doctests_fnames = set([]) exclude_dirs = [ '_images', '_output', '_weights', ] dpath_list = ['wbia_2d_orientation'] doctest_modname_list = ut.find_doctestable_modnames( dpath_list, exclude_doctests_fnames, exclude_dirs) for modname in doctest_modname_list: exec('import ' + modname, globals()) module_list = [sys.modules[name] for name in doctest_modname_list] nPass, nTotal, failed_cmd_list = ut.doctest_module_list(module_list) if nPass != nTotal: return 1 else: return 0
def run_tests(): # Build module list and run tests import sys ut.change_term_title('RUN ibeis_deepsense TESTS') exclude_doctests_fnames = set([]) exclude_dirs = [ '_doc', '_page', '*.egg-info', ] dpath_list = ['ibeis_deepsense'] doctest_modname_list = ut.find_doctestable_modnames( dpath_list, exclude_doctests_fnames, exclude_dirs) for modname in doctest_modname_list: exec('import ' + modname, globals(), locals()) module_list = [sys.modules[name] for name in doctest_modname_list] nPass, nTotal, failed_cmd_list = ut.doctest_module_list(module_list) if nPass != nTotal: return 1 else: return 0
def run_tests(): """ >>> from ibeis.tests.run_tests import * # NOQA """ # DONT USE THESE FLAGS #print('--testall and --testslow give you more tests') # starts logging for tests import ibeis ibeis._preload() # Build module list and run tests import sys ensure_testing_data() if False: ut.change_term_title('RUN IBEIS TESTS') exclude_doctests_fnames = set([ '_autogen_explicit_controller', 'template_definitions.py', 'autogen_test_script.py', ]) exclude_dirs = [ '_broken', 'old', 'tests', 'timeits', '_scripts', '_timeits', '_doc', 'notebook', ] if ut.in_pyinstaller_package(): from os.path import dirname dpath_list = [dirname(ibeis.__file__)] # Run tests for installer doctest_modname_list_ = [ 'ibeis.ibsfuncs', 'ibeis.viz.interact.interact_qres2', 'ibeis.viz.interact.interact_matches', 'ibeis.viz.interact.interact_annotations2', 'ibeis.viz.interact.interact_name', 'ibeis.viz.interact.interact_query_decision', 'ibeis.viz.interact.interact_chip', 'ibeis.viz.interact.interact_qres', 'ibeis.algo.Config', 'ibeis.algo.hots._pipeline_helpers', 'ibeis.algo.hots.name_scoring', 'ibeis.algo.hots.devcases', 'ibeis.algo.hots.neighbor_index', 'ibeis.algo.hots.automated_helpers', 'ibeis.algo.hots.hots_query_result', 'ibeis.algo.hots.automated_oracle', 'ibeis.algo.hots.nn_weights', 'ibeis.algo.hots.pipeline', 'ibeis.algo.hots.automated_params', 'ibeis.algo.hots.vsone_pipeline', 'ibeis.algo.hots.automatch_suggestor', 'ibeis.algo.hots.score_normalization', 'ibeis.algo.hots.query_request', 'ibeis.algo.hots.chip_match', 'ibeis.algo.hots.multi_index', 'ibeis.algo.hots.qt_inc_automatch', 'ibeis.algo.hots.query_params', 'ibeis.algo.hots.precision_recall', 'ibeis.algo.hots.hstypes', 'ibeis.algo.hots.match_chips4', 'ibeis.algo.hots.distinctiveness_normalizer', 'ibeis.algo.hots.automated_matcher', 'ibeis.algo.hots.special_query', 'ibeis.algo.hots.scoring', 'ibeis.algo.preproc.preproc_annot', 'ibeis.algo.preproc.preproc_imageset', 'ibeis.algo.preproc.preproc_image', 'ibeis.algo.preproc.preproc_residual', 'ibeis.algo.detect.grabmodels', 'ibeis.control.manual_annot_funcs', 'ibeis.control.manual_chip_funcs', 'ibeis.control.manual_species_funcs', 'ibeis.control.manual_ibeiscontrol_funcs', 'ibeis.control._autogen_party_funcs', 'ibeis.control.manual_garelate_funcs', 'ibeis.control.manual_name_funcs', 'ibeis.control._sql_helpers', 'ibeis.control.manual_wildbook_funcs', 'ibeis.control.controller_inject', 'ibeis.control.manual_lblimage_funcs', 'ibeis.control.IBEISControl', 'ibeis.control._autogen_featweight_funcs', 'ibeis.control.manual_imageset_funcs', 'ibeis.control.manual_feat_funcs', 'ibeis.control.manual_gsgrelate_funcs', 'ibeis.control._autogen_annotmatch_funcs', 'ibeis.control.manual_meta_funcs', 'ibeis.control.manual_lblannot_funcs', 'ibeis.control.DB_SCHEMA', 'ibeis.control.manual_lbltype_funcs', 'ibeis.control.SQLDatabaseControl', 'ibeis.control.manual_image_funcs', 'ibeis.control.manual_annotgroup_funcs', 'ibeis.control.DBCACHE_SCHEMA', 'ibeis.init.main_helpers', 'ibeis.init.sysres', 'ibeis.gui.clock_offset_gui', 'ibeis.dbio.export_subset', 'ibeis.dbio.export_hsdb', 'ibeis.dbio.ingest_database', ] else: dpath_list = ['ibeis'] doctest_modname_list_ = ut.find_doctestable_modnames( dpath_list, exclude_doctests_fnames, exclude_dirs) exclude_doctest_pattern = ut.get_argval( ('--exclude-doctest-patterns', '--x'), type_=list, default=[]) if exclude_doctest_pattern is not None: import re is_ok = [ all([ re.search(pat, name) is None for pat in exclude_doctest_pattern ]) for name in doctest_modname_list_ ] doctest_modname_list = ut.compress(doctest_modname_list_, is_ok) else: doctest_modname_list = doctest_modname_list_ doctest_modname_list2 = [] for modname in doctest_modname_list: try: exec('import ' + modname, globals(), locals()) except ImportError as ex: ut.printex(ex, iswarning=True) if not ut.in_pyinstaller_package(): raise else: doctest_modname_list2.append(modname) module_list = [sys.modules[name] for name in doctest_modname_list2] nPass, nTotal, failed_cmd_list = ut.doctest_module_list(module_list) if nPass != nTotal: return 1 else: return 0
import utool as ut import numpy as np import vtool as vt from ibeis.algo.hots import hstypes from ibeis.algo.hots import match_chips4 as mc4 from ibeis.algo.hots import distinctiveness_normalizer from ibeis.algo.hots import automated_params from six.moves import filter print, print_, printDBG, rrr, profile = ut.inject(__name__, '[special_query]') # hack for tests if ut.in_main_process(): test_title = ut.get_argval('--test-title', type_=str, default=None) if test_title is not None: ut.change_term_title(test_title) USE_VSMANY_HACK = ut.get_argflag('--vsmany-hack') TEST_VSONE_ERRORS = ut.get_argflag(('--test-vsone-errors', '--vsone-errs')) TestTup = ut.namedtuple('TestTup', ('qaid_t', 'qaid', 'vsmany_rank', 'vsone_rank')) def testdata_special_query(dbname=None): """ test data for special query doctests """ import ibeis if dbname is None: dbname = 'testdb1' # build test data ibs = ibeis.opendb(dbname)
else: dpath_list = [dirname(vt.__file__)] doctest_modname_list = ut.find_doctestable_modnames(dpath_list, exclude_doctests_fnames, exclude_dirs) modname_list2 = [] for modname in doctest_modname_list: try: exec("import " + modname, globals(), locals()) except ImportError as ex: ut.printex(ex) if not ut.in_pyinstaller_package(): raise else: modname_list2.append(modname) module_list = [sys.modules[name] for name in modname_list2] nPass, nTotal, failed_cmd_list = ut.doctest_module_list(module_list) if nPass != nTotal: return 1 else: return 0 if __name__ == "__main__": import multiprocessing ut.change_term_title("RUN VTOOL TESTS") multiprocessing.freeze_support() retcode = run_tests() sys.exit(retcode)
def rsync_ibsdb_main(): import sys default_user = ut.get_user_name() # default_db = 'MUGU_Master' default_db = None # Get positional commandline arguments cmdline_varags = ut.get_cmdline_varargs() if len(cmdline_varags) > 0 and cmdline_varags[0] == 'rsync': # ignore rsync as first command (b/c we are calling from ibeis.__main__) cmdline_varags = cmdline_varags[1:] valid_modes = ['push', 'pull', 'list'] if len(cmdline_varags) < 1: print('Usage: ' # 'python -m ibeis.scripts.rsync_ibeisdb' 'python -m ibeis rsync' '%s --db <db=%s> --user <user=%s>' % (valid_modes, default_db, default_user,)) sys.exit(1) varargs_dict = dict(enumerate(cmdline_varags)) mode = varargs_dict.get(0, None) default_db = varargs_dict.get(1, None) user = ut.get_argval('--user', type_=str, default=default_user) port = ut.get_argval('--port', type_=int, default=22) dbname = ut.get_argval(('--db', '--dbname'), type_=str, default=default_db) workdir = ut.get_argval(('--workdir', '--dbname'), type_=str, default=None, help_='local work dir override') dry_run = ut.get_argflag(('--dryrun', '--dry-run', '--dry')) assert mode in valid_modes, 'mode=%r must be in %r' % (mode, valid_modes) remote_key = ut.get_argval('--remote', type_=str, default='hyrule') remote_map = { 'hyrule': 'hyrule.cs.rpi.edu', 'pachy': 'pachy.cs.uic.edu', 'lewa': '41.203.223.178', 'lev': 'lev.cs.rpi.edu', } remote_workdir_map = { 'hyrule': '/raid/work', 'pachy': '/home/shared_ibeis/data/work', 'lewa': '/data/ibeis', 'lev': '/media/hdd/work', } if ':' in remote_key: remote_key_, remote_workdir = remote_key.split(':') else: remote_key_ = remote_key remote_workdir = remote_workdir_map.get(remote_key, '') remote = remote_map.get(remote_key_, remote_key_) remote_uri = user + '@' + remote + ':' + remote_workdir if mode == 'list': print('remote = %r' % (remote,)) print('need to list') remote_paths = ut.list_remote(remote_uri) print('REMOTE LS -- TODO need to get only ibeis dirs') print('\n'.join(remote_paths)) elif mode in ['push', 'pull']: ut.change_term_title('RSYNC IBEISDB %r' % (dbname,)) sync_ibeisdb(remote_uri, dbname, mode, workdir, port, dry_run)
#!/usr/bin/env python2.7 # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function import sys import utool as ut if __name__ == '__main__': import vtool.tests.run_tests import multiprocessing ut.change_term_title('RUN VTOOL TESTS') multiprocessing.freeze_support() retcode = vtool.tests.run_tests.run_tests() sys.exit(retcode)
def rsync_ibsdb_main(): import sys default_user = ut.get_user_name() # default_db = 'MUGU_Master' default_db = None # Get positional commandline arguments cmdline_varags = ut.get_cmdline_varargs() if len(cmdline_varags) > 0 and cmdline_varags[0] == 'rsync': # ignore rsync as first command (b/c we are calling from # wbia.__main__) cmdline_varags = cmdline_varags[1:] valid_modes = ['push', 'pull', 'list'] if len(cmdline_varags) < 1: logger.info('Usage: ' # 'python -m wbia.scripts.rsync_wbiadb' 'python -m wbia rsync' '%s --db <db=%s> --user <user=%s>' % (valid_modes, default_db, default_user)) sys.exit(1) varargs_dict = dict(enumerate(cmdline_varags)) mode = varargs_dict.get(0, None) default_db = varargs_dict.get(1, None) user = ut.get_argval('--user', type_=str, default=default_user) port = ut.get_argval('--port', type_=int, default=22) dbnames = ut.get_argval(('--db', '--dbs', '--dbname'), type_=str, default=default_db) dbnames = ut.smart_cast(dbnames, list) workdir = ut.get_argval(('--workdir'), type_=str, default=None, help_='local work dir override') dry_run = ut.get_argflag(('--dryrun', '--dry-run', '--dry')) assert mode in valid_modes, 'mode=%r must be in %r' % (mode, valid_modes) remote_key = ut.get_argval('--remote', type_=str, default='hyrule') remote_map = { 'hyrule': 'hyrule.cs.rpi.edu', 'pachy': 'pachy.cs.uic.edu', 'lewa': '41.203.223.178', } remote_workdir_map = { 'hyrule': '/raid/work', 'pachy': '/home/shared_wbia/data/work', 'lewa': '/data/wbia', } if ':' in remote_key: remote_key_, remote_workdir = remote_key.split(':') else: remote_key_ = remote_key if remote_key not in remote_workdir_map: import warnings warnings.warn('Workdir not specified for remote') remote_workdir = remote_workdir_map.get(remote_key, '') remote = remote_map.get(remote_key_, remote_key_) remote_uri = user + '@' + remote + ':' + remote_workdir if mode == 'list': logger.info('remote = %r' % (remote, )) logger.info('need to list') remote_paths = ut.list_remote(remote_uri) logger.info('REMOTE LS -- TODO need to get only wbia dirs') logger.info('\n'.join(remote_paths)) elif mode in ['push', 'pull']: logger.info('dbnames = {!r}'.format(dbnames)) for dbname in ut.ProgIter(dbnames, label='sync db'): ut.change_term_title('RSYNC IBEISDB %r' % (dbname, )) sync_wbiadb(remote_uri, dbname, mode, workdir, port, dry_run)
def rsync_ibsdb_main(): import sys default_user = ut.get_user_name() # default_db = 'MUGU_Master' default_db = None # Get positional commandline arguments cmdline_varags = ut.get_cmdline_varargs() if len(cmdline_varags) > 0 and cmdline_varags[0] == 'rsync': # ignore rsync as first command (b/c we are calling from ibeis.__main__) cmdline_varags = cmdline_varags[1:] valid_modes = ['push', 'pull', 'list'] if len(cmdline_varags) < 1: print('Usage: ' # 'python -m ibeis.scripts.rsync_ibeisdb' 'python -m ibeis rsync' '%s --db <db=%s> --user <user=%s>' % ( valid_modes, default_db, default_user, )) sys.exit(1) varargs_dict = dict(enumerate(cmdline_varags)) mode = varargs_dict.get(0, None) default_db = varargs_dict.get(1, None) user = ut.get_argval('--user', type_=str, default=default_user) port = ut.get_argval('--port', type_=int, default=22) dbname = ut.get_argval(('--db', '--dbname'), type_=str, default=default_db) workdir = ut.get_argval(('--workdir', '--dbname'), type_=str, default=None, help_='local work dir override') dry_run = ut.get_argflag(('--dryrun', '--dry-run', '--dry')) assert mode in valid_modes, 'mode=%r must be in %r' % (mode, valid_modes) remote_key = ut.get_argval('--remote', type_=str, default='hyrule') remote_map = { 'hyrule': 'hyrule.cs.rpi.edu', 'pachy': 'pachy.cs.uic.edu', 'lewa': '41.203.223.178', 'lev': 'lev.cs.rpi.edu', } remote_workdir_map = { 'hyrule': '/raid/work', 'pachy': '/home/shared_ibeis/data/work', 'lewa': '/data/ibeis', 'lev': '/media/hdd/work', } if ':' in remote_key: remote_key_, remote_workdir = remote_key.split(':') else: remote_key_ = remote_key remote_workdir = remote_workdir_map.get(remote_key, '') remote = remote_map.get(remote_key_, remote_key_) remote_uri = user + '@' + remote + ':' + remote_workdir if mode == 'list': print('remote = %r' % (remote, )) print('need to list') remote_paths = ut.list_remote(remote_uri) print('REMOTE LS -- TODO need to get only ibeis dirs') print('\n'.join(remote_paths)) elif mode in ['push', 'pull']: ut.change_term_title('RSYNC IBEISDB %r' % (dbname, )) sync_ibeisdb(remote_uri, dbname, mode, workdir, port, dry_run)
import utool as ut import numpy as np import vtool as vt from ibeis.algo.hots import hstypes from ibeis.algo.hots import match_chips4 as mc4 from ibeis.algo.hots import distinctiveness_normalizer from ibeis.algo.hots import automated_params from six.moves import filter print, print_, printDBG, rrr, profile = ut.inject(__name__, '[special_query]') # hack for tests if ut.in_main_process(): test_title = ut.get_argval('--test-title', type_=str, default=None) if test_title is not None: ut.change_term_title(test_title) USE_VSMANY_HACK = ut.get_argflag('--vsmany-hack') TEST_VSONE_ERRORS = ut.get_argflag(('--test-vsone-errors', '--vsone-errs')) TestTup = ut.namedtuple( 'TestTup', ( 'qaid_t', 'qaid', 'vsmany_rank', 'vsone_rank')) def testdata_special_query(dbname=None): """ test data for special query doctests """ import ibeis if dbname is None:
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function import utool as ut import sys if __name__ == '__main__': import utool.tests.run_tests import multiprocessing multiprocessing.freeze_support() ut.change_term_title('RUN UTOOL TESTS') retcode = utool.tests.run_tests.run_tests() sys.exit(retcode)