(
        self,
        test_results: Iterator[TestResult],
        fail_limit: Optional[int],
    )
Execute the test suite, returning the list of test results
        and a boolean that is true if the run was cancelled and false otherwise.
Execute the test suite, returning the list of test results
        and a boolean that is true if the run was cancelled and false otherwise.
Execute the test suite returning the list of test results and a boolean that is true if the run was cancelled and false otherwise .
def run(
        self,
        test_results: Iterator[TestResult],
        fail_limit: Optional[int],
    ) -> Tuple[List[TestResult], bool]:
        """
        Execute the test suite, returning the list of test results
        and a boolean that is true if the run was cancelled and false otherwise.
        """
        num_failures = 0
        results: List[TestResult] = []
        was_cancelled = False

        self.console.print()
        with self.live as live:
            try:
                for idx, result in enumerate(test_results):
                    # We need to re-enable the Live here in case
                    # it was disabled by the breakpoint debugger hook.
                    live.start(refresh=True)

                    for component in self.widgets:
                        component.after_test(idx, result)

                    live.update(self.footer(results))

                    results.append(result)

                    if result.outcome is TestOutcome.FAIL:
                        num_failures += 1

                    if num_failures == fail_limit:
                        break
            except KeyboardInterrupt:
                was_cancelled = True
            finally:
                for component in self.widgets:
                    component.after_suite(results)

                live.update(self.footer(results), refresh=True)

                return results, was_cancelled
def run ( self , test_results : Iterator [ TestResult ] , fail_limit : Optional [ int ] , ) -> Tuple [ List [ TestResult ] , bool ] : num_failures = 0 results : List [ TestResult ] = [ ] was_cancelled = False self . console . print ( ) with self . live as live : try : for idx , result in enumerate ( test_results ) : # We need to re-enable the Live here in case # it was disabled by the breakpoint debugger hook. live . start ( refresh = True ) for component in self . widgets : component . after_test ( idx , result ) live . update ( self . footer ( results ) ) results . append ( result ) if result . outcome is TestOutcome . FAIL : num_failures += 1 if num_failures == fail_limit : break except KeyboardInterrupt : was_cancelled = True finally : for component in self . widgets : component . after_suite ( results ) live . update ( self . footer ( results ) , refresh = True ) return results , was_cancelled