@@ -488,12 +488,11 @@ def test_function(self, data: ConjectureData) -> None:
488
488
self .debug (self .__pending_call_explanation )
489
489
self .__pending_call_explanation = None
490
490
491
- self .call_count += 1
492
-
493
491
interrupted = False
494
492
try :
495
493
self .__stoppable_test_function (data )
496
494
except KeyboardInterrupt :
495
+ self .call_count += 1
497
496
interrupted = True
498
497
raise
499
498
except BackendCannotProceed as exc :
@@ -508,12 +507,24 @@ def test_function(self, data: ConjectureData) -> None:
508
507
and (self .__failed_realize_count / self .call_count ) > 0.2
509
508
):
510
509
self ._switch_to_hypothesis_provider = True
510
+
511
+ assert data .status is Status .VALID
512
+ # we do not count BackendCannotProceed which did not make any choices
513
+ # against call_count.
514
+ # (if it did make choices, then it might have executed the test
515
+ # function, so we count it. The important invariant is
516
+ # self.call_count == "number of times test_* was called").
517
+ if data .length > 0 :
518
+ self .valid_examples += 1
519
+ self .call_count += 1
520
+
511
521
# skip the post-test-case tracking; we're pretending this never happened
512
522
interrupted = True
513
523
data .cannot_proceed_scope = exc .scope
514
524
data .freeze ()
515
525
return
516
526
except BaseException :
527
+ self .call_count += 1
517
528
data .freeze ()
518
529
if self .settings .backend != "hypothesis" :
519
530
realize_choices (data , for_failure = True )
@@ -542,6 +553,7 @@ def test_function(self, data: ConjectureData) -> None:
542
553
if data .misaligned_at is not None : # pragma: no branch # coverage bug?
543
554
self .misaligned_count += 1
544
555
556
+ self .call_count += 1
545
557
self .debug_data (data )
546
558
547
559
if (
0 commit comments