Esempio n. 1
0
 def test_poll_fails_busy_loop(self):
     num_tasks = 3
     checks = [SleepCheckPollFailLate(1/i) for i in range(1, num_tasks+1)]
     num_checks = len(checks)
     self.set_max_jobs(1)
     self.runall(checks)
     stats = self.runner.stats
     self.assertEqual(num_tasks, stats.num_cases())
     self.assertEqual(num_tasks, len(stats.failures()))
Esempio n. 2
0
def test_run_complete_fails_busy_loop(async_runner, make_cases, make_exec_ctx):
    make_exec_ctx(options=max_jobs_opts(1))
    runner, _ = async_runner
    num_checks = 3
    runner.runall(
        make_cases([
            SleepCheckPollFailLate(1),
            SleepCheck(0.1),
            SleepCheckPollFailLate(0.5)
        ]))
    assert_runall(runner)
    stats = runner.stats
    assert stats.num_cases() == num_checks
    assert len(stats.failed()) == 2

    # Verify that the succeeded test is the SleepCheck
    for t in stats.tasks():
        if not t.failed:
            assert isinstance(t.check, SleepCheck)
Esempio n. 3
0
def test_compile_fail_reschedule_busy_loop(async_runner, make_cases,
                                           make_exec_ctx):
    make_exec_ctx(options=max_jobs_opts(1))
    runner, _ = async_runner
    num_checks = 2
    runner.runall(
        make_cases([SleepCheckPollFailLate(1.5),
                    CompileFailureCheck()]))
    stats = runner.stats
    assert num_checks == stats.num_cases()
    assert_runall(runner)
    assert num_checks == len(stats.failed())
Esempio n. 4
0
def test_poll_fails_in_busy_loop(async_runner, make_cases,
                                 make_async_exec_ctx):
    ctx = make_async_exec_ctx(1)
    next(ctx)

    runner, _ = async_runner
    num_checks = 3
    runner.runall(make_cases([SleepCheckPollFailLate(1/i)
                              for i in range(1, num_checks+1)]))

    stats = runner.stats
    assert num_checks == stats.num_cases()
    assert_runall(runner)
    assert num_checks == len(stats.failures())