-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: wizard with Ctrl-C menu to go back, and more
- Loading branch information
Showing
3 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1731,6 +1731,53 @@ def test_multilingual_multispeaker_false_config(self): | |
self.assertIn("multilingual: false", text_to_spec_config) | ||
self.assertIn("multispeaker: false", text_to_spec_config) | ||
|
||
def test_control_c(self): | ||
# Three Ctrl-C exits | ||
tour = make_trivial_tour() | ||
with patch_input(KeyboardInterrupt()), patch_menu_prompt(KeyboardInterrupt()): | ||
with self.assertRaises(SystemExit): | ||
tour.run() | ||
|
||
# Ctrl-C plus option 4 (Exit) exits | ||
tour = make_trivial_tour() | ||
with patch_input(KeyboardInterrupt()): | ||
with patch_menu_prompt(4): # 4 is "Exit" in keyboard interrupt handling | ||
with self.assertRaises(SystemExit): | ||
tour.run() | ||
|
||
resulting_state = { | ||
SN.name_step.value: "project_name", | ||
SN.contact_name_step.value: "user name", | ||
SN.contact_email_step.value: "[email protected]", | ||
} | ||
|
||
tour = make_trivial_tour() | ||
with patch_input( | ||
["project_name", KeyboardInterrupt(), "user name", "[email protected]"], | ||
multi=True, | ||
): | ||
# Ctrl-C once, then hit 1 to continue | ||
with patch_menu_prompt([KeyboardInterrupt(), 1], multi=True): | ||
tour.run() | ||
self.assertEqual(tour.state, resulting_state) | ||
|
||
tour = make_trivial_tour() | ||
with patch_input( | ||
[ | ||
"bad_name", | ||
KeyboardInterrupt(), | ||
"project_name", | ||
"bad user name", | ||
KeyboardInterrupt(), | ||
"user name", | ||
"[email protected]", | ||
], | ||
multi=True, | ||
): | ||
with patch_menu_prompt(0): # say 0==go back each time | ||
tour.run() | ||
self.assertEqual(tour.state, resulting_state) | ||
|
||
def test_trace(self): | ||
tour = make_trivial_tour(trace=True) | ||
tour.trace = True | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters