diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2017-06-29 16:07:32 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-29 16:07:32 -0400 |
commit | 7a2f75c148fdaeeaba36e407e572f55f00f1de5c (patch) | |
tree | 5b63d530c0110eb996b2be03af6afca00c16bc20 /tests/test_cmd2.py | |
parent | 246a05c3411692ac8bffdcccecb09e434b5fcb53 (diff) | |
parent | 403a0808c5ab8e11a3d14e0e9472ee0b479c3041 (diff) | |
download | cmd2-git-7a2f75c148fdaeeaba36e407e572f55f00f1de5c.tar.gz |
Merge pull request #150 from python-cmd2/pipe_improvement
Pipe improvement
Diffstat (limited to 'tests/test_cmd2.py')
-rw-r--r-- | tests/test_cmd2.py | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index adf47d31..d294cd90 100644 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -402,15 +402,26 @@ def test_input_redirection(base_app, request): def test_pipe_to_shell(base_app): - # Get help on help and pipe it's output to the input of the word count shell command - out = run_cmd(base_app, 'help help | wc') - if sys.platform == "win32": - expected = normalize("1 11 71") + # Windows + # Get help menu and pipe it's output to the sort shell command + out = run_cmd(base_app, 'help | sort') + expected = ['', '', '_relative_load edit history pause pyscript run set shortcuts', + '========================================', + 'cmdenvironment help load py quit save shell show', + 'Documented commands (type help <topic>):'] + assert out == expected else: - expected = normalize("1 11 70") - - assert out[0].strip() == expected[0].strip() + # Mac and Linux + # Get help on help and pipe it's output to the input of the word count shell command + out = run_cmd(base_app, 'help help | wc') + + # Mac and Linux wc behave the same when piped from shell, but differently when piped stdin from file directly + if sys.platform == 'darwin': + expected = normalize("1 11 70") + else: + expected = normalize("1 11 70") + assert out[0].strip() == expected[0].strip() def test_send_to_paste_buffer(base_app): |