codeplain 0.3.13.dev48__py3-none-any.whl → 0.3.14.dev50__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- change_detection.py +65 -94
- cli_output/dry_run.py +7 -3
- {codeplain-0.3.13.dev48.dist-info → codeplain-0.3.14.dev50.dist-info}/METADATA +1 -1
- {codeplain-0.3.13.dev48.dist-info → codeplain-0.3.14.dev50.dist-info}/RECORD +49 -43
- codeplain_REST_api.py +9 -14
- docs/generate_cli.py +3 -2
- partial_rendering.py +32 -2
- plain2code.py +42 -14
- plain2code_arguments.py +69 -12
- plain2code_telemetry.py +2 -1
- plain2code_utils.py +14 -0
- plain_modules.py +73 -14
- render_machine/actions/analyze_specification_ambiguity.py +5 -3
- render_machine/actions/distill_conformance_test_memory.py +3 -1
- render_machine/actions/fix_conformance_test.py +4 -4
- render_machine/actions/fix_unit_tests.py +3 -1
- render_machine/actions/refactor_code.py +6 -1
- render_machine/actions/render_conformance_tests.py +52 -20
- render_machine/actions/render_functional_requirement.py +5 -2
- render_machine/actions/run_conformance_tests.py +3 -2
- render_machine/actions/summarize_conformance_tests.py +3 -1
- render_machine/render_context.py +59 -20
- render_machine/render_types.py +6 -15
- standard_template_library/typescript-react-app-boilerplate.plain +2 -1
- tests/test_acceptance_scenario_rendered_once.py +169 -0
- tests/test_acceptance_scenarios_after_a_code_fix.py +110 -0
- tests/test_change_detection.py +138 -127
- tests/test_conformance_fix_journal.py +46 -46
- tests/test_dry_run_link_validation.py +2 -1
- tests/test_fix_unit_tests_action.py +1 -1
- tests/test_frid_arguments.py +40 -0
- tests/test_functionality_without_scenarios.py +88 -0
- tests/test_git_utils.py +13 -13
- tests/test_partial_rendering.py +82 -47
- tests/test_plain2code.py +39 -41
- tests/test_plain2code_utils.py +12 -1
- tests/test_plain_modules.py +50 -44
- tests/test_render_finished_report.py +2 -0
- tests/test_render_range.py +18 -9
- tests/test_render_stop_reason.py +5 -5
- tests/test_telemetry.py +2 -2
- tests/test_terminal_attachment.py +2 -1
- tests/test_tests_folders.py +91 -0
- tests/test_traceability_warnings.py +69 -0
- tui/plain_module_render_choice_tui.py +4 -6
- tui/state_handlers.py +19 -28
- {codeplain-0.3.13.dev48.dist-info → codeplain-0.3.14.dev50.dist-info}/WHEEL +0 -0
- {codeplain-0.3.13.dev48.dist-info → codeplain-0.3.14.dev50.dist-info}/entry_points.txt +0 -0
- {codeplain-0.3.13.dev48.dist-info → codeplain-0.3.14.dev50.dist-info}/licenses/LICENSE +0 -0
tui/state_handlers.py
CHANGED
|
@@ -4,6 +4,7 @@ from abc import ABC, abstractmethod
|
|
|
4
4
|
from typing import Optional
|
|
5
5
|
|
|
6
6
|
from plain2code_events import RenderContextSnapshot
|
|
7
|
+
from plain2code_utils import qualified_frid
|
|
7
8
|
from render_machine.render_types import AcceptanceTestPhase
|
|
8
9
|
from render_machine.states import States
|
|
9
10
|
|
|
@@ -20,20 +21,10 @@ from .widget_helpers import (
|
|
|
20
21
|
)
|
|
21
22
|
|
|
22
23
|
|
|
23
|
-
def
|
|
24
|
-
"""
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
raw_text: The raw acceptance test text from specifications (can be None during state transitions)
|
|
28
|
-
|
|
29
|
-
Returns:
|
|
30
|
-
Formatted text with "- " prefix removed if present, or empty string if None
|
|
31
|
-
"""
|
|
32
|
-
if raw_text is None:
|
|
33
|
-
return ""
|
|
34
|
-
if raw_text.startswith("- "):
|
|
35
|
-
return raw_text[2:]
|
|
36
|
-
return raw_text
|
|
24
|
+
def _testing_functionality(snapshot: RenderContextSnapshot) -> str:
|
|
25
|
+
"""The functionality whose conformance tests are running, as `<module>:<func-id>`."""
|
|
26
|
+
ctx = snapshot.conformance_tests_running_context
|
|
27
|
+
return qualified_frid(ctx.current_testing_module_name, ctx.current_testing_frid)
|
|
37
28
|
|
|
38
29
|
|
|
39
30
|
class StateHandler(ABC):
|
|
@@ -70,7 +61,11 @@ class FridReadyHandler(StateHandler):
|
|
|
70
61
|
"""Handle READY_FOR_FRID_IMPLEMENTATION state."""
|
|
71
62
|
# Update FRID text
|
|
72
63
|
|
|
73
|
-
|
|
64
|
+
functionality = qualified_frid(snapshot.module_name, snapshot.frid_context.frid)
|
|
65
|
+
rendering_functionality_text = (
|
|
66
|
+
f"{tui_components.FRIDProgress.RENDERING_FUNCTIONALITY_TEXT}{functionality}: "
|
|
67
|
+
f"{snapshot.frid_context.functional_requirement_text}"
|
|
68
|
+
)
|
|
74
69
|
get_frid_progress(self.tui).update_functionality_text(rendering_functionality_text)
|
|
75
70
|
|
|
76
71
|
# Set progress states
|
|
@@ -200,15 +195,19 @@ class ConformanceTestsHandler(StateHandler):
|
|
|
200
195
|
phase = snapshot.conformance_tests_running_context.acceptance_test_phase
|
|
201
196
|
# Rendering full conformance tests (if there are no acceptance tests available or haven't been started yet)
|
|
202
197
|
if phase == AcceptanceTestPhase.NOT_STARTED or phase == AcceptanceTestPhase.NOT_APPLICABLE:
|
|
203
|
-
rendering_text = f"Rendering conformance tests for functionality {snapshot
|
|
198
|
+
rendering_text = f"Rendering conformance tests for functionality {_testing_functionality(snapshot)}"
|
|
204
199
|
update_progress_item_substates(
|
|
205
200
|
self.tui,
|
|
206
201
|
TUIComponents.FRID_PROGRESS_CONFORMANCE_TEST.value,
|
|
207
202
|
[Substate(rendering_text)],
|
|
208
203
|
)
|
|
209
204
|
else:
|
|
210
|
-
|
|
211
|
-
acceptance_test_text =
|
|
205
|
+
scenario = snapshot.conformance_tests_running_context.get_current_acceptance_scenario()
|
|
206
|
+
acceptance_test_text = (
|
|
207
|
+
f"Rendering acceptance test for scenario {scenario['id']}"
|
|
208
|
+
if scenario
|
|
209
|
+
else "Rendering acceptance test"
|
|
210
|
+
)
|
|
212
211
|
update_progress_item_substates(
|
|
213
212
|
self.tui,
|
|
214
213
|
TUIComponents.FRID_PROGRESS_CONFORMANCE_TEST.value,
|
|
@@ -221,21 +220,13 @@ class ConformanceTestsHandler(StateHandler):
|
|
|
221
220
|
[Substate("Preparing testing environment for conformance tests")],
|
|
222
221
|
)
|
|
223
222
|
elif segments[2] == States.CONFORMANCE_TEST_ENV_PREPARED.value:
|
|
224
|
-
running_text = f"Running conformance tests for functionality {snapshot
|
|
225
|
-
if snapshot.conformance_tests_running_context.current_testing_module_name != snapshot.module_name:
|
|
226
|
-
running_text += (
|
|
227
|
-
f" of module {snapshot.conformance_tests_running_context.current_testing_module_name}"
|
|
228
|
-
)
|
|
223
|
+
running_text = f"Running conformance tests for functionality {_testing_functionality(snapshot)}"
|
|
229
224
|
|
|
230
225
|
update_progress_item_substates(
|
|
231
226
|
self.tui, TUIComponents.FRID_PROGRESS_CONFORMANCE_TEST.value, [Substate(running_text)]
|
|
232
227
|
)
|
|
233
228
|
elif segments[2] == States.CONFORMANCE_TEST_FAILED.value:
|
|
234
|
-
fixing_text = f"Fixing conformance tests for functionality {snapshot
|
|
235
|
-
if snapshot.conformance_tests_running_context.current_testing_module_name != snapshot.module_name:
|
|
236
|
-
fixing_text += (
|
|
237
|
-
f" of module {snapshot.conformance_tests_running_context.current_testing_module_name}"
|
|
238
|
-
)
|
|
229
|
+
fixing_text = f"Fixing conformance tests for functionality {_testing_functionality(snapshot)}"
|
|
239
230
|
|
|
240
231
|
update_progress_item_substates(
|
|
241
232
|
self.tui, TUIComponents.FRID_PROGRESS_CONFORMANCE_TEST.value, [Substate(fixing_text)]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|