File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -847,6 +847,18 @@ def test_cmdloop_without_rawinput():
847847 out = app .stdout .getvalue ()
848848 assert out == expected
849849
850+ @pytest .mark .skipif (sys .platform .startswith ('win' ),
851+ reason = "stty sane only run on Linux/Mac" )
852+ def test_stty_sane (base_app , monkeypatch ):
853+ """Make sure stty sane is run on Linux/Mac after each command if stdin is a terminal"""
854+ with mock .patch ('sys.stdin.isatty' , mock .MagicMock (name = 'isatty' , return_value = True )):
855+ # Mock out the subprocess.Popen call so we don't actually run stty sane
856+ m = mock .MagicMock (name = 'Popen' )
857+ monkeypatch .setattr ("subprocess.Popen" , m )
858+
859+ base_app .onecmd_plus_hooks ('help' )
860+ m .assert_called_once_with (['stty' , 'sane' ])
861+
850862class HookFailureApp (cmd2 .Cmd ):
851863 def __init__ (self , * args , ** kwargs ):
852864 super ().__init__ (* args , ** kwargs )
You can’t perform that action at this time.
0 commit comments