Skip to content

Commit 6dfe27a

Browse files
committed
Send the conformance test scripts with the conformance tests generation request
The first conformance tests of a render often got the harness wrong: in markdown-blog-gen the tests launched the CLI from a directory derived from their own location, while the run script copies the build folder elsewhere and runs the tests from there. The generator never saw the scripts. The client now sends the contents of the conformance tests and prepare environment scripts with render_conformance_tests.
1 parent 322acc7 commit 6dfe27a

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

‎codeplain_REST_api.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,11 @@ def render_conformance_tests(
370370
conformance_tests_json,
371371
run_state: RunState,
372372
reference_conformance_tests: Optional[dict] = None,
373+
conformance_tests_script_content: str = "",
374+
prepare_environment_script_content: str = "",
373375
):
374376
"""`reference_conformance_tests`: files of an earlier functionality's passing conformance tests, by path, for
375-
the new tests to follow in their setup."""
377+
the new tests to follow in their setup. The script contents show how the harness runs the new tests."""
376378
endpoint_url = f"{self.api_url}/render_conformance_tests"
377379
headers = {"X-API-Key": self.api_key, "Content-Type": "application/json"}
378380

@@ -388,6 +390,8 @@ def render_conformance_tests(
388390
"conformance_tests_folder_name": conformance_tests_folder_name,
389391
"conformance_tests_json": conformance_tests_json,
390392
"reference_conformance_tests": reference_conformance_tests or {},
393+
"conformance_tests_script_content": conformance_tests_script_content,
394+
"prepare_environment_script_content": prepare_environment_script_content,
391395
}
392396

393397
response = self.post_request(endpoint_url, headers, payload, run_state)

‎render_machine/actions/render_conformance_tests.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from memory_management import MemoryManager
88
from plain2code_console import console
99
from render_machine.actions.base_action import BaseAction
10+
from render_machine.actions.fix_unit_tests import FixUnitTests
1011
from render_machine.implementation_code_helpers import ImplementationCodeHelpers
1112
from render_machine.render_context import RenderContext
1213
from render_machine.render_types import AcceptanceTestPhase, TestExecutionPhase
@@ -162,6 +163,8 @@ def _render_conformance_tests(self, render_context: RenderContext):
162163
),
163164
run_state=render_context.run_state,
164165
reference_conformance_tests=reference_conformance_tests,
166+
conformance_tests_script_content=FixUnitTests._read_script(render_context.conformance_tests_script),
167+
prepare_environment_script_content=FixUnitTests._read_script(render_context.prepare_environment_script),
165168
)
166169

167170
self._warn_about_untraced_scenarios(render_context, traceability)

0 commit comments

Comments
 (0)