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


Python Main.execute方法代码示例

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


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

示例1: test_it_should_accept_a_schema_version_option_if_current_version_is_a_file

# 需要导入模块: from simple_virtuoso_migrate.main import Main [as 别名]
# 或者: from simple_virtuoso_migrate.main.Main import execute [as 别名]
    def test_it_should_accept_a_schema_version_option_if_current_version_is_a_file(self, cli_mock, _execution_log_mock, simplevirtuosomigrate_mock, virtuoso_mock, execute_migrations_mock):
        self.initial_config.update({"schema_version":"version", "file_migration":None})
        main = Main(Config(self.initial_config))
        main.execute()

        expected_calls = [
            call('\nStarting Virtuoso migration...', 'PINK', log_level_limit=1),
            call('\nDone.\n', 'PINK', log_level_limit=1)
        ]
        self.assertEqual(expected_calls, _execution_log_mock.mock_calls)
        execute_migrations_mock.assert_called_with('sparql_up', 'sparql_down', 'current_file', 'version')
开发者ID:rodsenra,项目名称:simple-virtuoso-migrate,代码行数:13,代码来源:main_test.py

示例2: test_it_should_migrate_db_if_create_migration_option_is_not_activated_by_user

# 需要导入模块: from simple_virtuoso_migrate.main import Main [as 别名]
# 或者: from simple_virtuoso_migrate.main.Main import execute [as 别名]
    def test_it_should_migrate_db_if_create_migration_option_is_not_activated_by_user(self, migrate_mock, _execution_log_mock):
        config = Config(self.initial_config)
        main = Main(config)
        main.execute()

        expected_calls = [
            call('\nStarting Virtuoso migration...', 'PINK', log_level_limit=1),
            call('\nDone.\n', 'PINK', log_level_limit=1)
        ]
        self.assertEqual(expected_calls, _execution_log_mock.mock_calls)
        self.assertEqual(1, migrate_mock.call_count)
开发者ID:rodsenra,项目名称:simple-virtuoso-migrate,代码行数:13,代码来源:main_test.py

示例3: test_it_should_not_accept_file_migration_option_if_current_version_is_already_a_file

# 需要导入模块: from simple_virtuoso_migrate.main import Main [as 别名]
# 或者: from simple_virtuoso_migrate.main.Main import execute [as 别名]
    def test_it_should_not_accept_file_migration_option_if_current_version_is_already_a_file(self, cli_mock, _execution_log_mock, virtuoso_mock, execute_migrations_mock):
        self.initial_config.update({"file_migration":"migration"})
        main = Main(Config(self.initial_config))
        try:
            main.execute()
        except SystemExit:
            pass

        expected_calls = [
            call('\nStarting Virtuoso migration...', 'PINK', log_level_limit=1),
            call('- Current version is: current_file', 'GREEN', log_level_limit=1),
            call('- Destination version is: migration', 'GREEN', log_level_limit=1)
        ]
        self.assertEqual(expected_calls, _execution_log_mock.mock_calls)
        cli_mock.assert_called_with("[ERROR] Can't execute migration FROM File TO File (TIP: version it using git --tag and then use -m)\n", 'RED')
        self.assertEqual(0, execute_migrations_mock.call_count)
开发者ID:rodsenra,项目名称:simple-virtuoso-migrate,代码行数:18,代码来源:main_test.py

示例4: test_it_should_add_triples_if_the_database_is_not_empty_and_the_option_is_activated_by_the_user

# 需要导入模块: from simple_virtuoso_migrate.main import Main [as 别名]
# 或者: from simple_virtuoso_migrate.main.Main import execute [as 别名]
    def test_it_should_add_triples_if_the_database_is_not_empty_and_the_option_is_activated_by_the_user(self, run_isql_mock, current_version_mock, execute_change_mock, _execution_log_mock):
        self.initial_config.update({'load_ttl':'new_triple.ttl', 'show_sparql_only':None})
        main = Main(Config(self.initial_config))
        main.execute()

        expected_calls = [
            call('\nStarting Virtuoso migration...', 'PINK', log_level_limit=1),
            call("- TTL(s) to upload: ['new_triple.ttl']", 'GREEN', log_level_limit=1),
            call('- Current version is: 0.1', 'GREEN', log_level_limit=1),
            call('- Destination version is: 0.1', 'GREEN', log_level_limit=1),
            call('\nStarting Migration!', log_level_limit=1),
            call('===== executing =====', log_level_limit=1),
            call('', log_level_limit=1),
            call('\nDone.\n', 'PINK', log_level_limit=1)
        ]
        self.assertEqual(expected_calls, _execution_log_mock.mock_calls)
开发者ID:rodsenra,项目名称:simple-virtuoso-migrate,代码行数:18,代码来源:main_test.py

示例5: test_it_should_add_triples_if_the_database_is_not_empty_and_the_option_is_activated_by_the_user

# 需要导入模块: from simple_virtuoso_migrate.main import Main [as 别名]
# 或者: from simple_virtuoso_migrate.main.Main import execute [as 别名]
    def test_it_should_add_triples_if_the_database_is_not_empty_and_the_option_is_activated_by_the_user(self, current_version_mock, statements_mock, execute_change_mock, _execution_log_mock):
        self.initial_config.update({'add_ttl':'new_triples', 'show_sparql_only':None})
        main = Main(Config(self.initial_config))
        main.execute()

        expected_calls = [
            call('\nStarting Virtuoso migration...', 'PINK', log_level_limit=1),
            call('- TTL to insert is: new_triples', 'GREEN', log_level_limit=1),
            call('- Current version is: 0.1', 'GREEN', log_level_limit=1),
            call('- Destination version is: new_triples', 'GREEN', log_level_limit=1),
            call('\nStarting Migration!', log_level_limit=1),
            call('===== executing =====', log_level_limit=1),
            call('\nDone.\n', 'PINK', log_level_limit=1)
        ]
        self.assertEqual(expected_calls, _execution_log_mock.mock_calls)
        statements_mock.assert_called_with('new_triples', '0.1', 'git')
        execute_change_mock.assert_called_with('sparql_up', 'sparql_down', execution_log=_execution_log_mock)
开发者ID:icaromedeiros,项目名称:simple-virtuoso-migrate,代码行数:19,代码来源:main_test.py

示例6: test_it_should_not_add_triples_if_show_sparql_only_option_is_activated_by_the_user

# 需要导入模块: from simple_virtuoso_migrate.main import Main [as 别名]
# 或者: from simple_virtuoso_migrate.main.Main import execute [as 别名]
    def test_it_should_not_add_triples_if_show_sparql_only_option_is_activated_by_the_user(self, current_version_mock, execute_change_mock, _execution_log_mock):
        self.initial_config.update({'load_ttl':'new_triple.ttl', 'show_sparql_only':True})
        main = Main(Config(self.initial_config))
        main.execute()

        expected_calls = [
            call('\nStarting Virtuoso migration...', 'PINK', log_level_limit=1),
            call("- TTL(s) to upload: ['new_triple.ttl']", 'GREEN', log_level_limit=1),
#            call('- Current version is: 0.1', 'GREEN', log_level_limit=1),
#            call('- Destination version is: 0.1', 'GREEN', log_level_limit=1),
#            call("\nWARNING: commands are not being executed ('--show_sparql_only' activated)", 'RED', log_level_limit=1),
#            call('__________ SPARQL statements executed __________', 'YELLOW', log_level_limit=1),
#            call('sparql_up', 'YELLOW', log_level_limit=1),
#            call('_____________________________________________', 'YELLOW', log_level_limit=1),
            call('\nDone.\n', 'PINK', log_level_limit=1)
        ]
        self.assertEqual(expected_calls, _execution_log_mock.mock_calls)
        self.assertEqual(0, execute_change_mock.call_count)
开发者ID:rodsenra,项目名称:simple-virtuoso-migrate,代码行数:20,代码来源:main_test.py

示例7: test_it_should_get_current_and_destination_versions_and_execute_migrations

# 需要导入模块: from simple_virtuoso_migrate.main import Main [as 别名]
# 或者: from simple_virtuoso_migrate.main.Main import execute [as 别名]
 def test_it_should_get_current_and_destination_versions_and_execute_migrations(self, virtuoso_mock, _get_destination_version_mock, execute_migrations_mock):
     main = Main(Config(self.initial_config))
     main.execute()
     execute_migrations_mock.assert_called_with('sparql_up', 'sparql_down', 'current_version', 'destination_version')
开发者ID:rodsenra,项目名称:simple-virtuoso-migrate,代码行数:6,代码来源:main_test.py

示例8: test_should_exec_and_fail_with_invalid_after_script

# 需要导入模块: from simple_virtuoso_migrate.main import Main [as 别名]
# 或者: from simple_virtuoso_migrate.main.Main import execute [as 别名]
 def test_should_exec_and_fail_with_invalid_after_script(self, load_triples_mock, execution_log_mock):
     self.initial_config.update({'load_ttl':'', 'run_after': 'tests/samples/invalid_run_after.py'})
     main = Main(Config(self.initial_config))
     main.execute()
     execution_log_mock.mock_calls[-2].called_with('\nRun after script tests/samples/invalid_run_after.py does not have run_after() function .\n', 'PINK', 1)
开发者ID:globocom,项目名称:simple-virtuoso-migrate,代码行数:7,代码来源:main_test.py

示例9: test_should_exec_and_call_run_after_script

# 需要导入模块: from simple_virtuoso_migrate.main import Main [as 别名]
# 或者: from simple_virtuoso_migrate.main.Main import execute [as 别名]
 def test_should_exec_and_call_run_after_script(self, valid_version_mock, load_triples_mock, execution_log_mock):
     self.initial_config.update({'load_ttl':'', 'run_after': 'tests/samples/validate_run_after.py'})
     main = Main(Config(self.initial_config))
     main.execute()
     self.assertEqual(valid_version_mock.call_count, 2)
开发者ID:globocom,项目名称:simple-virtuoso-migrate,代码行数:7,代码来源:main_test.py

示例10: test_it_should_call_run_after_method_after_calling_execute

# 需要导入模块: from simple_virtuoso_migrate.main import Main [as 别名]
# 或者: from simple_virtuoso_migrate.main.Main import execute [as 别名]
 def test_it_should_call_run_after_method_after_calling_execute(self, load_triples_mock, run_after_mock, execution_log_mock):
     self.initial_config.update({'load_ttl':'', 'run_after': 'some_script_name'})
     main = Main(Config(self.initial_config))
     main.execute()
     self.assertEqual(execution_log_mock.call_count, 3)
     run_after_mock.assert_called_with('some_script_name', None)
开发者ID:globocom,项目名称:simple-virtuoso-migrate,代码行数:8,代码来源:main_test.py


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