This commit is contained in:
@@ -79,6 +79,12 @@ class DoEpicTest(unittest.TestCase):
|
||||
self.issues = [issue("ABC-20", "repo:api")]
|
||||
return folder
|
||||
|
||||
def epic_run(self, fake: FakeEffects, env: dict[str, str] | None = None) -> main.EpicRun:
|
||||
config = main.load(self.home)
|
||||
assert not isinstance(config, Failure)
|
||||
store, record = self.backend(config, "ABC-12")
|
||||
return main.EpicRun("ABC-12", config, store, record, paths_from(self.home), env or {}, pathlib.Path("/b/do-epic"), fake.effects())
|
||||
|
||||
def run_main(self, argv: list[str], fake: FakeEffects, env: dict[str, str] | None = None) -> tuple[int, str, str]:
|
||||
out, err = io.StringIO(), io.StringIO()
|
||||
with contextlib.redirect_stdout(out), contextlib.redirect_stderr(err):
|
||||
@@ -146,13 +152,16 @@ class TheCommand(DoEpicTest):
|
||||
|
||||
|
||||
class ACycleOfAChunkWithoutARepo(DoEpicTest):
|
||||
def test_a_chunk_in_a_folder_no_project_config_names_stops_with_the_reason(self) -> None:
|
||||
stopped = main.chunk_work("ABC-21", str(self.home), "English", self.epic_run(FakeEffects()))
|
||||
assert isinstance(stopped, main.Stop)
|
||||
self.assertEqual(stopped.code, 1)
|
||||
self.assertIn("rev-parse", stopped.reason)
|
||||
|
||||
def cycle(self, env: dict[str, str] | None = None) -> main.Cycle:
|
||||
fake = FakeEffects(git=[Failure("no git"), Failure("no git")])
|
||||
paths = paths_from(self.home)
|
||||
config = main.load(self.home)
|
||||
assert not isinstance(config, Failure)
|
||||
store, record = self.backend(config, "ABC-12")
|
||||
epic = main.EpicRun("ABC-12", config, store, record, paths, env or {}, pathlib.Path("/b/do-epic"), fake.effects())
|
||||
epic = self.epic_run(fake, env)
|
||||
place = main.chunk_root("ABC-21", epic)
|
||||
assert isinstance(place, tuple)
|
||||
root, repo = place
|
||||
|
||||
@@ -302,6 +302,10 @@ class TheFirstPrompt(unittest.TestCase):
|
||||
)
|
||||
self.assertEqual(chunk_prompt.task(issue("ABC-20"), "ABC-12", "/code/api", pathlib.Path("/b/do-epic"), "Swedish", "Ship it so."), f"Work the Jira issue ABC-20 of the epic ABC-12 as one chunk, in the checkout /code/api, on the branch ABC-20. {told} Ship it so. Its summary: Do ABC-20")
|
||||
|
||||
def test_a_chunk_without_a_repo_has_no_shipping_sentence(self) -> None:
|
||||
self.assertEqual(chunk_prompt.task(issue("ABC-20"), "ABC-12", None, pathlib.Path("/b/do-epic"), "Swedish", "").count(" "), 0)
|
||||
self.assertTrue(chunk_prompt.task(issue("ABC-20"), "ABC-12", None, pathlib.Path("/b/do-epic"), "Swedish", "").endswith("Swedish, the epic's language. Its summary: Do ABC-20"))
|
||||
|
||||
def test_a_repo_with_a_plan_file_ships_the_chunk_with_a_bullet_in_its_changelog(self) -> None:
|
||||
config = settings.ProjectConfig("api", pathlib.Path("/c/api"), pathlib.Path("/code/api"), {"changelog": pathlib.Path("/code/api/CHANGELOG.md")})
|
||||
self.assertEqual(chunk_prompt.shipping(config), "The issue is no item of the repo's plan, so give `chunk-pr merge` no `--finish`. Where the repo publishes something others consume, ship the change with one bullet for its users under `## Unreleased` in /code/api/CHANGELOG.md, added in the branch; otherwise write none.")
|
||||
|
||||
Reference in New Issue
Block a user