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


Python assertions.assert_call函数代码示例

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


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

示例1: test_manual_start_with_run_time

    def test_manual_start_with_run_time(self):
        run_time = datetime.datetime(2012, 3, 14, 15, 9, 26)
        manual_runs = self.job_scheduler.manual_start(run_time)

        assert_call(self.job.build_new_runs, 0, run_time, manual=True)
        assert_length(manual_runs, 1)
        assert_length(self.manual_run.start.calls, 1)
开发者ID:ninsen,项目名称:Tron,代码行数:7,代码来源:job_test.py

示例2: test_start_no_startable_action_runs

    def test_start_no_startable_action_runs(self):
        self.job_run._do_start = Turtle()
        self.job_run.action_runs.has_startable_action_runs = False

        assert not self.job_run.start()
        assert_call(self.job_run.notify, 0, self.job_run.EVENT_START)
        assert_length(self.job_run.notify.calls, 1)
开发者ID:Bklyn,项目名称:Tron,代码行数:7,代码来源:jobrun_test.py

示例3: test_handler_finished_with_cleanup

    def test_handler_finished_with_cleanup(self):
        self.job_run.action_runs.cleanup_action_run = Turtle(is_done=False)
        self.job_run.finalize = Turtle()

        self.job_run.handler(None, actionrun.ActionRun.STATE_SUCCEEDED)
        assert_length(self.job_run.finalize.calls, 0)
        assert_call(self.job_run.action_runs.cleanup_action_run.start, 0)
开发者ID:Bklyn,项目名称:Tron,代码行数:7,代码来源:jobrun_test.py

示例4: test_start

    def test_start(self):
        self.job_run._do_start = Turtle()

        assert self.job_run.start()
        assert_call(self.job_run.notify, 0, self.job_run.EVENT_START)
        assert_call(self.job_run._do_start, 0)
        assert_length(self.job_run.notify.calls, 1)
开发者ID:Bklyn,项目名称:Tron,代码行数:7,代码来源:jobrun_test.py

示例5: test_get_runs_to_schedule_no_last_run

    def test_get_runs_to_schedule_no_last_run(self):
        self.job.runs.get_newest = lambda **kwargs: None

        job_runs = list(self.job_scheduler.get_runs_to_schedule())
        assert_length(self.job.scheduler.next_run_time.calls, 1)
        assert_length(job_runs, 1)
        # This should return a JobRun which has the job attached as an observer
        assert_call(job_runs[0].attach, 0, True, self.job)
开发者ID:ninsen,项目名称:Tron,代码行数:8,代码来源:job_test.py

示例6: test_handle_job_events_no_schedule_on_complete

 def test_handle_job_events_no_schedule_on_complete(self):
     self.job_scheduler.run_job = mock.Mock()
     self.job.scheduler.schedule_on_complete = False
     queued_job_run = mock.Mock()
     self.job.runs.get_first_queued = lambda: queued_job_run
     self.job_scheduler.handle_job_events(self.job, job.Job.NOTIFY_RUN_DONE)
     assert_call(self.reactor.callLater, 0, 0,
         self.job_scheduler.run_job, queued_job_run, run_queued=True)
开发者ID:Bklyn,项目名称:Tron,代码行数:8,代码来源:job_test.py

示例7: test_remove_old_runs

    def test_remove_old_runs(self):
        self.run_collection.run_limit = 1
        self.run_collection.remove_old_runs()

        assert_length(self.run_collection.runs, 1)
        assert_call(self.job_runs[-1].cleanup, 0)
        for job_run in self.run_collection.runs:
            assert_length(job_run.cancel.calls, 0)
开发者ID:pombredanne,项目名称:Tron,代码行数:8,代码来源:jobrun_test.py

示例8: test_get_runs_to_schedule_no_pending

    def test_get_runs_to_schedule_no_pending(self):
        job_runs = list(self.job_scheduler.get_runs_to_schedule())

        assert_call(self.job.runs.get_newest, 0, include_manual=False)
        assert_length(self.job.scheduler.next_run_time.calls, 1)
        assert_length(job_runs, 1)
        # This should return a JobRun which has the job attached as an observer
        assert_call(job_runs[0].attach, 0, True, self.job)
开发者ID:ninsen,项目名称:Tron,代码行数:8,代码来源:job_test.py

示例9: test_restore_job_state

 def test_restore_job_state(self):
     run_collection = mocks.MockJobRunCollection(get_scheduled=lambda: ['a'])
     self.job_scheduler.job = Turtle(runs=run_collection)
     self.job_scheduler._set_callback = Turtle()
     state_data = 'state_data_token'
     self.job_scheduler.restore_state(state_data)
     assert_call(self.job_scheduler.job.restore_state, 0, state_data)
     assert_length(self.job_scheduler._set_callback.calls, 1)
     assert_call(self.job_scheduler._set_callback, 0, 'a')
开发者ID:ContextLogic,项目名称:Tron,代码行数:9,代码来源:job_test.py

示例10: test_reconfigure

    def test_reconfigure(self):
        self.mcp._load_config = Turtle()
        self.mcp.state_manager = mock.Mock()
        cm = mocks.MockContextManager()
        self.mcp.state_manager.disabled = mock.Mock(return_value=cm)

        self.mcp.reconfigure()
        assert_call(self.mcp._load_config, 0, reconfigure=True)
        self.mcp.state_manager.disabled.assert_called_with()
开发者ID:Bklyn,项目名称:Tron,代码行数:9,代码来源:mcp_test.py

示例11: test_set_action_runs

 def test_set_action_runs(self):
     self.job_run._action_runs = None
     action_runs = [Turtle(), Turtle()]
     run_collection = Turtle(action_runs_with_cleanup=action_runs)
     self.job_run._set_action_runs(run_collection)
     assert_length(self.job_run.watch.calls, 2)
     for i in xrange(2):
         assert_call(self.job_run.watch, i, action_runs[i])
     assert_equal(self.job_run.action_runs, run_collection)
     assert self.job_run.action_runs_proxy
开发者ID:Bklyn,项目名称:Tron,代码行数:10,代码来源:jobrun_test.py

示例12: test_cleanup

    def test_cleanup(self):
        self.job_run.clear_observers = Turtle()
        self.job_run.output_path = Turtle()
        self.job_run.cleanup()

        assert_call(self.job_run.clear_observers, 0)
        assert_call(self.job_run.output_path.delete, 0)
        assert not self.job_run.node
        assert not self.job_run.action_graph
        assert not self.job_run.action_runs
开发者ID:Bklyn,项目名称:Tron,代码行数:10,代码来源:jobrun_test.py

示例13: test_handler_with_startable

    def test_handler_with_startable(self):
        self.job_run.action_runs.get_startable_action_runs = lambda: True
        startable_run = Turtle()
        self.job_run.action_runs.get_startable_action_runs = lambda: [startable_run]
        self.job_run.finalize = Turtle()

        self.job_run.handler(None, actionrun.ActionRun.STATE_SUCCEEDED)
        assert_call(self.job_run.notify, 0, self.job_run.NOTIFY_STATE_CHANGED)
        assert_call(startable_run.start, 0)
        assert_length(self.job_run.finalize.calls, 0)
开发者ID:Bklyn,项目名称:Tron,代码行数:10,代码来源:jobrun_test.py

示例14: test_restore_state_partial

    def test_restore_state_partial(self):
        def restore(jobs, services):
            return {'1': 'thing'}, {'2': 'thing'}
        self.mcp.state_watcher = Turtle(restore=restore)
        self.mcp.restore_state()

        assert_call(self.mcp.jobs['1'].restore_job_state, 0, 'thing')
        assert_length(self.mcp.jobs['2'].restore_job_state.calls, 0)
        assert_length(self.mcp.services['1'].restore_service_state.calls, 0)
        assert_call(self.mcp.services['2'].restore_service_state, 0, 'thing')
开发者ID:strategist922,项目名称:Tron,代码行数:10,代码来源:mcp_test.py

示例15: test_restore_state

 def test_restore_state(self):
     def restore(jobs, services):
         state_data = {'1': 'things', '2': 'things'}
         return state_data, state_data
     self.mcp.state_watcher = Turtle(restore=restore)
     self.mcp.restore_state()
     for job in self.mcp.jobs.values():
         assert_call(job.restore_job_state, 0, 'things')
     for service in self.mcp.services.values():
         assert_call(service.restore_service_state, 0, 'things')
开发者ID:strategist922,项目名称:Tron,代码行数:10,代码来源:mcp_test.py


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