'Check that run_pending() runs pending jobs.
We do this by overriding datetime.datetime with mock objects
that represent increasing system times.
Please note that it is *intended behavior that run_pending() does not
run missed jobs*. For example, if you\'ve registered a job that
should run every minute and you only call run_pending() in one hour
increments then your job won\'t be run 60 times in between but
only once.'

def test_run_pending(self):

    mock_job = make_mock_job()
    with mock_datetime(2010, 1, 6, 12, 15):
        every().minute.do(mock_job)
        every().hour.do(mock_job)
        every().day.do(mock_job)
        every().sunday.do(mock_job)
        schedule.run_pending()
        assert (mock_job.call_count == 0)
    with mock_datetime(2010, 1, 6, 12, 16):
        schedule.run_pending()
        assert (mock_job.call_count == 1)
    with mock_datetime(2010, 1, 6, 13, 16):
        mock_job.reset_mock()
        schedule.run_pending()
        assert (mock_job.call_count == 2)
    with mock_datetime(2010, 1, 7, 13, 16):
        mock_job.reset_mock()
        schedule.run_pending()
        assert (mock_job.call_count == 3)
    with mock_datetime(2010, 1, 10, 13, 16):
        mock_job.reset_mock()
        schedule.run_pending()
        assert (mock_job.call_count == 4)
