當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。