当前位置: 首页>>代码示例>>Python>>正文


Python TvbProfile._build_profile_class方法代码示例

本文整理汇总了Python中tvb.basic.profile.TvbProfile._build_profile_class方法的典型用法代码示例。如果您正苦于以下问题:Python TvbProfile._build_profile_class方法的具体用法?Python TvbProfile._build_profile_class怎么用?Python TvbProfile._build_profile_class使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tvb.basic.profile.TvbProfile的用法示例。


在下文中一共展示了TvbProfile._build_profile_class方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _fake_restart_services

# 需要导入模块: from tvb.basic.profile import TvbProfile [as 别名]
# 或者: from tvb.basic.profile.TvbProfile import _build_profile_class [as 别名]
 def _fake_restart_services(self, should_reset):
     """
     This function will replace the SettingsController._restart_service method,
     to avoid problems in tests due to restart.
     """
     self.was_reset = should_reset
     TvbProfile._build_profile_class(TvbProfile.CURRENT_PROFILE_NAME)
开发者ID:LauHoiYanGladys,项目名称:tvb-framework,代码行数:9,代码来源:settings_controllers_test.py

示例2: test_read_stored_settings

# 需要导入模块: from tvb.basic.profile import TvbProfile [as 别名]
# 或者: from tvb.basic.profile.TvbProfile import _build_profile_class [as 别名]
    def test_read_stored_settings(self):
        """
        Test to see that keys from the configuration dict is updated with
        the value from the configuration file after store.
        """
        initial_configurations = self.settings_service.configurable_keys
        to_store_data = {key: value['value'] for key, value in initial_configurations.iteritems()}
        for key, value in self.TEST_SETTINGS.iteritems():
            to_store_data[key] = value

        is_changed, shoud_reset = self.settings_service.save_settings(**to_store_data)
        assert shoud_reset and is_changed

        # enforce keys to get repopulated:
        TvbProfile._build_profile_class(TvbProfile.CURRENT_PROFILE_NAME)
        self.settings_service = SettingsService()

        updated_configurations = self.settings_service.configurable_keys
        for key, value in updated_configurations.iteritems():
            if key in self.TEST_SETTINGS:
                assert self.TEST_SETTINGS[key] == value['value']
            elif key == SettingsService.KEY_ADMIN_PWD:
                assert TvbProfile.current.web.admin.ADMINISTRATOR_PASSWORD == value['value']
                assert TvbProfile.current.web.admin.ADMINISTRATOR_BLANK_PWD == initial_configurations[key]['value']
            else:
                assert initial_configurations[key]['value'] == value['value']
开发者ID:maedoc,项目名称:tvb-framework,代码行数:28,代码来源:settings_service_test.py

示例3: teardown_method

# 需要导入模块: from tvb.basic.profile import TvbProfile [as 别名]
# 或者: from tvb.basic.profile.TvbProfile import _build_profile_class [as 别名]
    def teardown_method(self):
        """
        Restore configuration file
        """
        if os.path.exists(TEST_CONFIG_FILE):
            os.remove(TEST_CONFIG_FILE)

        TvbProfile.current.__class__.TVB_CONFIG_FILE = self.old_config_file
        TvbProfile._build_profile_class(TvbProfile.CURRENT_PROFILE_NAME)
开发者ID:maedoc,项目名称:tvb-framework,代码行数:11,代码来源:settings_service_test.py

示例4: cleanup

# 需要导入模块: from tvb.basic.profile import TvbProfile [as 别名]
# 或者: from tvb.basic.profile.TvbProfile import _build_profile_class [as 别名]
    def cleanup(self):
        """
        Have a different name than transactional_teardown_method so we can use it safely in transactions and it will
        not be called after running actual test.
        Using transactional_teardown_method here won't WORK!! See TransactionalTest
        """
        if os.path.exists(TvbProfile.current.TVB_CONFIG_FILE):
            os.remove(TvbProfile.current.TVB_CONFIG_FILE)

        TvbProfile._build_profile_class(TvbProfile.CURRENT_PROFILE_NAME)
开发者ID:maedoc,项目名称:tvb-framework,代码行数:12,代码来源:base_controller_test.py

示例5: setup_method

# 需要导入模块: from tvb.basic.profile import TvbProfile [as 别名]
# 或者: from tvb.basic.profile.TvbProfile import _build_profile_class [as 别名]
    def setup_method(self):
        """
        Prepare the usage of a different config file for this class only.
        """
        if os.path.exists(TEST_CONFIG_FILE):
            os.remove(TEST_CONFIG_FILE)

        self.old_config_file = TvbProfile.current.TVB_CONFIG_FILE
        TvbProfile.current.__class__.TVB_CONFIG_FILE = TEST_CONFIG_FILE
        TvbProfile._build_profile_class(TvbProfile.CURRENT_PROFILE_NAME)
        self.settings_service = SettingsService()
开发者ID:maedoc,项目名称:tvb-framework,代码行数:13,代码来源:settings_service_test.py

示例6: test_update_settings

# 需要导入模块: from tvb.basic.profile import TvbProfile [as 别名]
# 或者: from tvb.basic.profile.TvbProfile import _build_profile_class [as 别名]
    def test_update_settings(self):
        """
        Test update of settings: correct flags should be returned, and check storage folder renamed
        """
        # 1. save on empty config-file:
        to_store_data = {key: value['value'] for key, value in self.settings_service.configurable_keys.iteritems()}
        for key, value in self.TEST_SETTINGS.iteritems():
            to_store_data[key] = value

        is_changed, shoud_reset = self.settings_service.save_settings(**to_store_data)
        assert shoud_reset and is_changed

        # 2. Reload and save with the same values (is_changed expected to be False)
        TvbProfile._build_profile_class(TvbProfile.CURRENT_PROFILE_NAME)
        self.settings_service = SettingsService()
        to_store_data = {key: value['value'] for key, value in self.settings_service.configurable_keys.iteritems()}

        is_changed, shoud_reset = self.settings_service.save_settings(**to_store_data)
        assert not is_changed
        assert not shoud_reset

        # 3. Reload and check that changing TVB_STORAGE is done correctly
        TvbProfile._build_profile_class(TvbProfile.CURRENT_PROFILE_NAME)
        self.settings_service = SettingsService()
        to_store_data = {key: value['value'] for key, value in self.settings_service.configurable_keys.iteritems()}
        to_store_data[SettingsService.KEY_STORAGE] = os.path.join(TvbProfile.current.TVB_STORAGE, 'RENAMED')

        # Write a test-file and check that it is moved
        file_writer = open(os.path.join(TvbProfile.current.TVB_STORAGE, "test_rename-xxx43"), 'w')
        file_writer.write('test-content')
        file_writer.close()

        is_changed, shoud_reset = self.settings_service.save_settings(**to_store_data)
        assert is_changed
        assert not shoud_reset
        # Check that the file was correctly moved:
        data = open(os.path.join(TvbProfile.current.TVB_STORAGE, 'RENAMED', "test_rename-xxx43"), 'r').read()
        assert data == 'test-content'

        shutil.rmtree(os.path.join(TvbProfile.current.TVB_STORAGE, 'RENAMED'))
        os.remove(os.path.join(TvbProfile.current.TVB_STORAGE, "test_rename-xxx43"))
开发者ID:maedoc,项目名称:tvb-framework,代码行数:43,代码来源:settings_service_test.py


注:本文中的tvb.basic.profile.TvbProfile._build_profile_class方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。