示例#1
0
 def test_result_history_keeps_track_of_result_changes(self):
     # XXX: this example will fail if subsequent results are identical
     self.assertEqual(self.job_state.result_history, ())
     result1 = make_job_result(outcome='fail')
     self.job_state.result = result1
     self.assertEqual(self.job_state.result_history, (result1, ))
     result2 = make_job_result(outcome='pass')
     self.job_state.result = result2
     self.assertEqual(self.job_state.result_history, (result1, result2))
示例#2
0
 def make_test_session(self):
     # Create a small session with two jobs and two results
     job_a = make_job('job_a')
     job_b = make_job('job_b')
     session = SessionState([job_a, job_b])
     session.update_desired_job_list([job_a, job_b])
     result_a = make_job_result(outcome=IJobResult.OUTCOME_PASS)
     result_b = make_job_result(outcome=IJobResult.OUTCOME_FAIL)
     session.update_job_result(job_a, result_a)
     session.update_job_result(job_b, result_b)
     return session
示例#3
0
    def test_setting_result_fires_signal(self):
        """
        verify that assigning state.result fires the on_result_changed signal
        """
        # Remember both new and old result for verification
        new_result = make_job_result()
        old_result = self.job_state.result

        def changed_callback(old, new):
            # Verify that new and old are correct and not swapped
            self.assertIs(new, new_result)
            self.assertIs(old, old_result)
            # Set a flag that we verify below in case this never gets called
            self.on_changed_fired = True
        # Connect the signal handler
        self.job_state.on_result_changed.connect(changed_callback)
        # Assign the new result
        self.job_state.result = new_result
        # Ensure that the signal was fired and called our callback
        self.assertTrue(self.on_changed_fired)
示例#4
0
 def test_setting_result(self):
     result = make_job_result()
     self.job_state.result = result
     self.assertIs(self.job_state.result, result)