本文整理匯總了Python中simple_virtuoso_migrate.main.Main._execute_migrations方法的典型用法代碼示例。如果您正苦於以下問題:Python Main._execute_migrations方法的具體用法?Python Main._execute_migrations怎麽用?Python Main._execute_migrations使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類simple_virtuoso_migrate.main.Main
的用法示例。
在下文中一共展示了Main._execute_migrations方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_it_should_do_nothing_if_sparql_up_has_two_lines
# 需要導入模塊: from simple_virtuoso_migrate.main import Main [as 別名]
# 或者: from simple_virtuoso_migrate.main.Main import _execute_migrations [as 別名]
def test_it_should_do_nothing_if_sparql_up_has_two_lines(self, _execution_log_mock, virtuoso_mock):
main = Main(Config(self.initial_config))
main._execute_migrations("sparql_up line 1\nsparql_up line 2", "sparql_down line 1\nsparql_down line 2", "current_version", "destination_version")
expected_calls = [
call('- Current version is: current_version', 'GREEN', log_level_limit=1),
call('- Destination version is: destination_version', 'GREEN', log_level_limit=1),
call('\nStarting Migration!', log_level_limit=1),
call('\nNothing to do.\n', 'PINK', log_level_limit=1)
]
self.assertEqual(expected_calls, _execution_log_mock.mock_calls)
self.assertEqual(0, main.virtuoso.execute_change.call_count)
示例2: test_it_should_use_virtuoso_class_to_get_migration_and_execute_changes
# 需要導入模塊: from simple_virtuoso_migrate.main import Main [as 別名]
# 或者: from simple_virtuoso_migrate.main.Main import _execute_migrations [as 別名]
def test_it_should_use_virtuoso_class_to_get_migration_and_execute_changes(self, _execution_log_mock, virtuoso_mock):
main = Main(Config(self.initial_config))
main._execute_migrations("sparql_up line 1\nsparql_up line 2\nsparql_up line 3", "sparql_down line 1\nsparql_down line 2\nsparql_down line 3", "current_version", "destination_version")
expected_calls = [
call('- Current version is: current_version', 'GREEN', log_level_limit=1),
call('- Destination version is: destination_version', 'GREEN', log_level_limit=1),
call('\nStarting Migration!', log_level_limit=1),
call('===== executing =====', log_level_limit=1)
]
self.assertEqual(expected_calls, _execution_log_mock.mock_calls)
main.virtuoso.execute_change.assert_called_with("sparql_up line 1\nsparql_up line 2\nsparql_up line 3", "sparql_down line 1\nsparql_down line 2\nsparql_down line 3", execution_log=_execution_log_mock)
示例3: test_it_should_not_execute_any_sparql_if_asked_to_show_sparql_only
# 需要導入模塊: from simple_virtuoso_migrate.main import Main [as 別名]
# 或者: from simple_virtuoso_migrate.main.Main import _execute_migrations [as 別名]
def test_it_should_not_execute_any_sparql_if_asked_to_show_sparql_only(self, _execution_log_mock, virtuoso_mock):
self.initial_config.update({"show_sparql_only":True})
main = Main(Config(self.initial_config))
main._execute_migrations("sparql_up line 1\nsparql_up line 2\nsparql_up line 3", "sparql_down line 1\nsparql_down line 2\nsparql_down line 3", "current_version", "destination_version")
expected_calls = [
call('- Current version is: current_version', 'GREEN', log_level_limit=1),
call('- Destination version is: destination_version', '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 line 1\nsparql_up line 2\nsparql_up line 3', 'YELLOW', log_level_limit=1),
call('_____________________________________________', 'YELLOW', log_level_limit=1)
]
self.assertEqual(expected_calls, _execution_log_mock.mock_calls)
self.assertEqual(0, main.virtuoso.execute_change.call_count)
示例4: test_it_should_log_executed_sparql_if_asked_to_show_sparql
# 需要導入模塊: from simple_virtuoso_migrate.main import Main [as 別名]
# 或者: from simple_virtuoso_migrate.main.Main import _execute_migrations [as 別名]
def test_it_should_log_executed_sparql_if_asked_to_show_sparql(self, _execution_log_mock, virtuoso_mock):
self.initial_config.update({"show_sparql":True})
main = Main(Config(self.initial_config))
main._execute_migrations("sparql_up line 1\nsparql_up line 2\nsparql_up line 3", "sparql_down line 1\nsparql_down line 2\nsparql_down line 3", "current_version", "destination_version")
expected_calls = [
call('- Current version is: current_version', 'GREEN', log_level_limit=1),
call('- Destination version is: destination_version', 'GREEN', log_level_limit=1),
call('\nStarting Migration!', log_level_limit=1),
call('===== executing =====', log_level_limit=1),
call('__________ SPARQL statements executed __________', 'YELLOW', log_level_limit=1),
call('sparql_up line 1\nsparql_up line 2\nsparql_up line 3', 'YELLOW', log_level_limit=1),
call('_____________________________________________', 'YELLOW', log_level_limit=1)
]
self.assertEqual(expected_calls, _execution_log_mock.mock_calls)