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


Python publish_step.PluginStep类代码示例

本文整理汇总了Python中pulp.plugins.util.publish_step.PluginStep的典型用法代码示例。如果您正苦于以下问题:Python PluginStep类的具体用法?Python PluginStep怎么用?Python PluginStep使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: test_process_lifecycle_exception_still_removes_working_dir

 def test_process_lifecycle_exception_still_removes_working_dir(self, super_pl, mock_rmtree):
     step = PluginStep("foo", working_dir=self.working_dir, conduit=self.conduit)
     step._build_final_report = Mock()
     self.assertRaises(Exception, step.process_lifecycle)
     super_pl.assert_called_once_with()
     self.assertFalse(step._build_final_report.called)
     mock_rmtree.assert_called_once_with(self.working_dir, ignore_errors=True)
开发者ID:hgschmie,项目名称:pulp,代码行数:7,代码来源:test_publish_step.py

示例2: test_process_lifecycle_non_existent_working_dir

 def test_process_lifecycle_non_existent_working_dir(self, mock_wd, mock_rmtree, mock_progress,
                                                     mock_build_report):
     new_dir = os.path.join(self.working_dir, 'test', 'bar')
     mock_wd.return_value = new_dir
     step = PluginStep("foo")
     step.process_lifecycle()
     self.assertTrue(os.path.exists(new_dir))
     mock_rmtree.assert_called_once_with(new_dir, ignore_errors=True)
开发者ID:hgschmie,项目名称:pulp,代码行数:8,代码来源:test_publish_step.py

示例3: test_process_lifecycle_reports_on_error

    def test_process_lifecycle_reports_on_error(self):
        # set working_dir and conduit. This is required by process_lifecycle
        step = PluginStep('parent', working_dir=self.working_dir, conduit=self.conduit)
        step.process = Mock(side_effect=Exception('Foo'))
        step.report_progress = Mock()

        self.assertRaises(Exception, step.process_lifecycle)

        step.report_progress.assert_called_once_with(force=True)
开发者ID:hgschmie,项目名称:pulp,代码行数:9,代码来源:test_publish_step.py

示例4: test_process_step_failure_reported_on_metadata_finalized

 def test_process_step_failure_reported_on_metadata_finalized(self, mock_get_units):
     self.pluginstep.repo.content_unit_counts = {'FOO_TYPE': 1}
     mock_get_units.return_value = ['mock_unit']
     step = PluginStep('foo_step')
     step.parent = self.pluginstep
     step.finalize = Mock(side_effect=Exception())
     self.assertRaises(Exception, step.process)
     self.assertEquals(step.state, reporting_constants.STATE_FAILED)
     self.assertEquals(step.progress_successes, 1)
     self.assertEquals(step.progress_failures, 1)
     self.assertEquals(step.total_units, 1)
开发者ID:hgschmie,项目名称:pulp,代码行数:11,代码来源:test_publish_step.py

示例5: test_build_final_report_success

    def test_build_final_report_success(self):

        step_one = PluginStep('step_one')
        step_one.state = reporting_constants.STATE_COMPLETE
        step_two = PluginStep('step_two')
        step_two.state = reporting_constants.STATE_COMPLETE
        self.pluginstep.add_child(step_one)
        self.pluginstep.add_child(step_two)

        report = self.pluginstep._build_final_report()

        self.assertTrue(report.success_flag)
开发者ID:hgschmie,项目名称:pulp,代码行数:12,代码来源:test_publish_step.py

示例6: test_record_failure

    def test_record_failure(self):
        plugin_step = PluginStep('foo_step')
        plugin_step.parent = self.pluginstep

        error_msg = 'Too bad, so sad'

        try:
            raise Exception(error_msg)

        except Exception, e:
            tb = sys.exc_info()[2]
            plugin_step._record_failure(e, tb)
开发者ID:hgschmie,项目名称:pulp,代码行数:12,代码来源:test_publish_step.py

示例7: test_process_lifecycle

    def test_process_lifecycle(self):
        # set working_dir and conduit. This is required by process_lifecycle
        step = PluginStep('parent', working_dir=self.working_dir, conduit=self.conduit)
        step.process = Mock()
        child_step = PluginStep('child', working_dir=self.working_dir, conduit=self.conduit)
        child_step.process = Mock()
        step.add_child(child_step)
        step.report_progress = Mock()

        step.process_lifecycle()

        step.process.assert_called_once_with()
        child_step.process.assert_called_once_with()
        step.report_progress.assert_called_once_with(force=True)
开发者ID:hgschmie,项目名称:pulp,代码行数:14,代码来源:test_publish_step.py

示例8: test_cancel_before_processing

 def test_cancel_before_processing(self):
     self.pluginstep.repo.content_unit_counts = {'FOO_TYPE': 2}
     step = PluginStep('foo_step')
     step.is_skipped = Mock()
     step.cancel()
     step.process()
     self.assertEquals(0, step.is_skipped.call_count)
开发者ID:hgschmie,项目名称:pulp,代码行数:7,代码来源:test_publish_step.py

示例9: test_get_progress_report_summary

 def test_get_progress_report_summary(self):
     parent_step = PluginStep('parent_step')
     step = PluginStep('foo_step')
     parent_step.add_child(step)
     step.state = reporting_constants.STATE_COMPLETE
     report = parent_step.get_progress_report_summary()
     target_report = {
         'foo_step': reporting_constants.STATE_COMPLETE
     }
     compare_dict(report, target_report)
开发者ID:hgschmie,项目名称:pulp,代码行数:10,代码来源:test_publish_step.py

示例10: test_process_child_on_error_notifies_parent

    def test_process_child_on_error_notifies_parent(self):
        # set working_dir and conduit. This is required by process_lifecycle
        step = PluginStep('parent', working_dir=self.working_dir, conduit=self.conduit)
        child_step = PluginStep('child', working_dir=self.working_dir, conduit=self.conduit)
        child_step.initialize = Mock(side_effect=Exception('boo'))
        child_step.on_error = Mock(side_effect=Exception('flux'))
        step.on_error = Mock()

        step.add_child(child_step)

        self.assertRaises(Exception, step.process_lifecycle)

        self.assertEquals(reporting_constants.STATE_FAILED, step.state)
        self.assertEquals(reporting_constants.STATE_FAILED, child_step.state)
        self.assertTrue(step.on_error.called)
        self.assertTrue(child_step.on_error.called)
开发者ID:hgschmie,项目名称:pulp,代码行数:16,代码来源:test_publish_step.py

示例11: test_get_progress_report_description

    def test_get_progress_report_description(self):
        step = PluginStep('bar_step')
        step.description = 'bar'
        step.error_details = "foo"
        step.state = reporting_constants.STATE_COMPLETE
        step.total_units = 2
        step.progress_successes = 1
        step.progress_failures = 1
        report = step.get_progress_report()

        target_report = {
            reporting_constants.PROGRESS_STEP_TYPE_KEY: 'bar_step',
            reporting_constants.PROGRESS_NUM_SUCCESSES_KEY: 1,
            reporting_constants.PROGRESS_STATE_KEY: step.state,
            reporting_constants.PROGRESS_ERROR_DETAILS_KEY: step.error_details,
            reporting_constants.PROGRESS_NUM_PROCESSED_KEY: 2,
            reporting_constants.PROGRESS_NUM_FAILURES_KEY: 1,
            reporting_constants.PROGRESS_ITEMS_TOTAL_KEY: 2,
            reporting_constants.PROGRESS_DESCRIPTION_KEY: 'bar',
            reporting_constants.PROGRESS_DETAILS_KEY: '',
            reporting_constants.PROGRESS_STEP_UUID: step.uuid
        }

        compare_dict(report[0], target_report)
开发者ID:hgschmie,项目名称:pulp,代码行数:24,代码来源:test_publish_step.py

示例12: test_get_working_dir_from_repo

 def test_get_working_dir_from_repo(self):
     step = PluginStep('foo_step')
     step.get_repo = Mock(return_value=Mock(working_dir='foo'))
     self.assertEquals('foo', step.get_working_dir())
开发者ID:hgschmie,项目名称:pulp,代码行数:4,代码来源:test_publish_step.py

示例13: test_get_repo

 def test_get_repo(self):
     step = PluginStep('foo_step')
     step.repo = 'foo'
     self.assertEquals('foo', step.get_repo())
开发者ID:hgschmie,项目名称:pulp,代码行数:4,代码来源:test_publish_step.py

示例14: test_get_conduit_from_parent

 def test_get_conduit_from_parent(self):
     step = PluginStep('foo_step')
     step.conduit = 'foo'
     step.parent = Mock()
     step.parent.get_conduit.return_value = 'foo'
     self.assertEquals('foo', step.get_conduit())
开发者ID:hgschmie,项目名称:pulp,代码行数:6,代码来源:test_publish_step.py

示例15: test_get_conduit

 def test_get_conduit(self):
     step = PluginStep('foo_step')
     step.conduit = 'foo'
     self.assertEquals('foo', step.get_conduit())
开发者ID:hgschmie,项目名称:pulp,代码行数:4,代码来源:test_publish_step.py


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