def init_test_env(): """ This method prepares all necessary data for tests execution """ default_mlab_exe = cfg.MATLAB_EXECUTABLE cfg.MATLAB_EXECUTABLE = get_matlab_executable() reset_database() initialize(["tvb.config", "tvb_test"], load_xml_events=False) cfg.MATLAB_EXECUTABLE = default_mlab_exe
def init_test_env(): """ This method prepares all necessary data for tests execution """ # Set a default test profile, for when running tests from dev-env. if TvbProfile.CURRENT_PROFILE_NAME is None: TvbProfile.set_profile(TvbProfile.TEST_SQLITE_PROFILE) print "Not expected to happen except from PyCharm: setting profile", TvbProfile.CURRENT_PROFILE_NAME db_file = TvbProfile.current.db.DB_URL.replace("sqlite:///", "") if os.path.exists(db_file): os.remove(db_file) from tvb.core.entities.model_manager import reset_database from tvb.core.services.initializer import initialize reset_database() initialize(["tvb.config", "tvb.tests.framework"], skip_import=True)
def init_test_env(): """ This method prepares all necessary data for tests execution """ # Set a default test profile, for when running tests from dev-env. if TvbProfile.CURRENT_PROFILE_NAME is None: TvbProfile.set_profile(TvbProfile.TEST_SQLITE_PROFILE) print "Not expected to happen except from PyCharm: setting profile", TvbProfile.CURRENT_PROFILE_NAME db_file = TvbProfile.current.db.DB_URL.replace('sqlite:///', '') if os.path.exists(db_file): os.remove(db_file) from tvb.core.entities.model_manager import reset_database from tvb.core.services.initializer import initialize reset_database() initialize(["tvb.config", "tvb.tests.framework"], skip_import=True)
def start_tvb(arguments): """ Fire CherryPy server and listen on a free port """ if PARAM_RESET_DB in arguments: ##### When specified, clean everything in DB reset() arguments.remove(PARAM_RESET_DB) if not os.path.exists(TVBSettings.TVB_STORAGE): try: os.makedirs(TVBSettings.TVB_STORAGE) except Exception: sys.exit("You do not have enough rights to use TVB storage folder:" + str(TVBSettings.TVB_STORAGE)) try: initialize(arguments) except InvalidSettingsException, excep: LOGGER.exception(excep) sys.exit()
def start_tvb(arguments, browser=True): """ Fire CherryPy server and listen on a free port """ if PARAM_RESET_DB in arguments: ##### When specified, clean everything in DB reset() arguments.remove(PARAM_RESET_DB) if not os.path.exists(TvbProfile.current.TVB_STORAGE): try: os.makedirs(TvbProfile.current.TVB_STORAGE) except Exception: sys.exit("You do not have enough rights to use TVB storage folder:" + str(TvbProfile.current.TVB_STORAGE)) try: initialize(arguments) except InvalidSettingsException, excep: LOGGER.exception(excep) sys.exit()
def init_test_env(): """ This method prepares all necessary data for tests execution """ # Set a default test profile, for when running tests from dev-env. if TvbProfile.CURRENT_PROFILE_NAME is None: profile = TvbProfile.TEST_SQLITE_PROFILE if len(sys.argv) > 1: for i in range(1,len(sys.argv)-1): if "--profile=" in sys.argv[i]: profile = sys.argv[i].split("=")[1] TvbProfile.set_profile(profile) print("Not expected to happen except from PyCharm: setting profile", TvbProfile.CURRENT_PROFILE_NAME) db_file = TvbProfile.current.db.DB_URL.replace('sqlite:///', '') if os.path.exists(db_file): os.remove(db_file) from tvb.core.entities.model_manager import reset_database from tvb.core.services.initializer import initialize reset_database() initialize(["tvb.config", "tvb.tests.framework"], skip_import=True)
def start_tvb(arguments, browser=True): """ Fire CherryPy server and listen on a free port """ if PARAM_RESET_DB in arguments: ##### When specified, clean everything in DB reset() arguments.remove(PARAM_RESET_DB) if not os.path.exists(TvbProfile.current.TVB_STORAGE): try: os.makedirs(TvbProfile.current.TVB_STORAGE) except Exception: sys.exit("You do not have enough rights to use TVB storage folder:" + str(TvbProfile.current.TVB_STORAGE)) try: initialize(arguments) except InvalidSettingsException as excep: LOGGER.exception(excep) sys.exit() #### Mark that the interface is Web ABCDisplayer.VISUALIZERS_ROOT = TvbProfile.current.web.VISUALIZERS_ROOT ABCDisplayer.VISUALIZERS_URL_PREFIX = TvbProfile.current.web.VISUALIZERS_URL_PREFIX init_cherrypy(arguments) #### Fire a browser page at the end. if browser: run_browser() ## Launch CherryPy loop forever. LOGGER.info("Finished starting TVB version %s in %.3f s", TvbProfile.current.version.CURRENT_VERSION, time.time() - STARTUP_TIC) cherrypy.engine.block() cherrypy.log.error_log