Skip to content

Commit f0d65e2

Browse files
committed
Not repeating the last er
1 parent 37b01db commit f0d65e2

2 files changed

Lines changed: 47 additions & 22 deletions

File tree

render_machine/render_context.py

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ def get_next_conformance_tests_running_context(self):
279279
def start_unittests_processing_in_conformance_tests(self):
280280
self.start_unittests_processing()
281281
self.conformance_tests_running_context.implementation_code_was_updated = False
282+
self.conformance_tests_running_context.regression_run_started = True
282283
self.conformance_tests_running_context = self.get_first_conformance_tests_running_context()
283284

284285
def finish_unittests_processing(self):
@@ -352,10 +353,13 @@ def start_testing_environment_preparation(self):
352353

353354
def start_conformance_tests_processing(self):
354355
console.info("Implementing conformance tests...")
356+
current_frid_specifications, _ = plain_spec.get_specifications_for_frid(
357+
self.plain_source_tree, self.frid_context.frid
358+
)
355359
self.conformance_tests_running_context = ConformanceTestsRunningContext(
356360
current_testing_module_name=self.module_name,
357-
current_testing_frid=None,
358-
current_testing_frid_specifications=None,
361+
current_testing_frid=self.frid_context.frid,
362+
current_testing_frid_specifications=current_frid_specifications,
359363
conformance_test_phase_index=0,
360364
fix_attempts=0,
361365
conformance_tests_json=self.conformance_tests.get_conformance_tests_json(self.module_name),
@@ -370,10 +374,6 @@ def implementation_code_was_updated_in_conformance_tests(self) -> bool:
370374
return self.conformance_tests_running_context.implementation_code_was_updated
371375

372376
def start_conformance_tests_for_frid(self):
373-
if self.conformance_tests_running_context.implementation_code_was_updated:
374-
self.conformance_tests_running_context.implementation_code_was_updated = False
375-
self.conformance_tests_running_context.current_testing_frid = None
376-
377377
if self.conformance_tests_running_context.regenerating_conformance_tests:
378378
if self.verbose:
379379
console.info(
@@ -390,36 +390,60 @@ def start_conformance_tests_for_frid(self):
390390
self.conformance_tests_running_context.fix_attempts = 0
391391
self.conformance_tests_running_context.regenerating_conformance_tests = False
392392
else:
393-
# This block is now only executed for the main (last) module. This means that no conformance tests
394-
# postprocessing is taking place. Maybe it should?
395-
if (
396-
self.conformance_tests_running_context.current_testing_module_name == self.module_name
393+
if self.conformance_tests_running_context.implementation_code_was_updated:
394+
self.conformance_tests_running_context.implementation_code_was_updated = False
395+
self.conformance_tests_running_context.regression_run_started = True
396+
self.conformance_tests_running_context.current_testing_frid = None
397+
398+
# This block handles phase-based rendering for the current FRID being implemented.
399+
# Only runs before regression starts — during regression the current FRID is treated
400+
# as an existing test like any other.
401+
elif (
402+
not self.conformance_tests_running_context.regression_run_started
403+
and self.conformance_tests_running_context.current_testing_module_name == self.module_name
397404
and self.conformance_tests_running_context.current_testing_frid == self.frid_context.frid
398405
):
406+
if not self.conformance_tests_running_context.current_conformance_tests_exist():
407+
# No entry yet — RenderConformanceTests will create it on this action cycle
408+
return
409+
399410
if not self.frid_context.specifications.get(
400411
plain_spec.ACCEPTANCE_TESTS
401412
) or self.conformance_tests_running_context.conformance_test_phase_index == len(
402413
self.frid_context.specifications[plain_spec.ACCEPTANCE_TESTS]
403414
):
404-
self.machine.dispatch(triggers.MARK_ALL_CONFORMANCE_TESTS_PASSED)
415+
# All phases done — start regression run over earlier FRIDs
416+
self.conformance_tests_running_context.regression_run_started = True
417+
self.conformance_tests_running_context.current_testing_frid = None
418+
# fall through to get_first below
419+
else:
420+
if self.conformance_tests_running_context.conformance_test_phase_index == 0:
421+
self.conformance_tests_running_context.current_testing_frid_high_level_implementation_plan = None
422+
423+
self.conformance_tests_running_context.conformance_test_phase_index += 1
424+
current_acceptance_tests = self.frid_context.specifications[plain_spec.ACCEPTANCE_TESTS][
425+
: self.conformance_tests_running_context.conformance_test_phase_index
426+
]
427+
self.conformance_tests_running_context.get_conformance_tests_json(
428+
self.conformance_tests_running_context.current_testing_module_name
429+
)[self.frid_context.frid][plain_spec.ACCEPTANCE_TESTS] = current_acceptance_tests
405430
return
406-
if self.conformance_tests_running_context.conformance_test_phase_index == 0:
407-
self.conformance_tests_running_context.current_testing_frid_high_level_implementation_plan = None
408-
409-
self.conformance_tests_running_context.conformance_test_phase_index += 1
410-
current_acceptance_tests = self.frid_context.specifications[plain_spec.ACCEPTANCE_TESTS][
411-
: self.conformance_tests_running_context.conformance_test_phase_index
412-
]
413-
self.conformance_tests_running_context.get_conformance_tests_json(
414-
self.conformance_tests_running_context.current_testing_module_name
415-
)[self.frid_context.frid][plain_spec.ACCEPTANCE_TESTS] = current_acceptance_tests
416-
return
417431

418432
if self.conformance_tests_running_context.current_testing_frid is None:
419433
self.conformance_tests_running_context = self.get_first_conformance_tests_running_context()
420434
else:
421435
self.conformance_tests_running_context = self.get_next_conformance_tests_running_context()
422436

437+
# Detect regression completion: we've reached the current FRID (don't re-run it)
438+
if self.conformance_tests_running_context.regression_run_started:
439+
current = self.conformance_tests_running_context.current_testing_frid
440+
if self.conformance_tests_running_context.current_testing_module_name == self.module_name and (
441+
current is None or current == self.frid_context.frid
442+
):
443+
self.conformance_tests_running_context.current_testing_frid = self.frid_context.frid
444+
self.machine.dispatch(triggers.MARK_ALL_CONFORMANCE_TESTS_PASSED)
445+
return
446+
423447
if self.conformance_tests_running_context.current_testing_module_name == self.module_name:
424448
self.conformance_tests_running_context.current_testing_frid_specifications, _ = (
425449
plain_spec.get_specifications_for_frid(

render_machine/render_types.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def __init__(
4747
# - conformance_test_phase_index == 0 (conformance tests phase)
4848
self.regenerating_conformance_tests: bool = False
4949
self.implementation_code_was_updated: bool = False
50+
self.regression_run_started: bool = False
5051
self.current_testing_frid_high_level_implementation_plan: Optional[str] = None
5152
self.previous_conformance_tests_issue_old: Optional[str] = None
5253
self.previous_conformance_tests_issue_frid: Optional[str] = None

0 commit comments

Comments
 (0)