Skip to content

Commit

Permalink
Merge pull request #181 from python-cmd2/custom_intro
Browse files Browse the repository at this point in the history
Added a unit test for custom intro when calling cmdloop()
  • Loading branch information
tleonhardt authored Jul 8, 2017
2 parents 770a568 + 87e0b94 commit 891fe3f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ News
0.7.5
-----

*Release date: 2017-TBD*
*Release date: 2017-07-08*

* Bug Fixes
* `case_insensitive` is no longer a runtime-settable parameter, but it was still listed as such
Expand All @@ -17,6 +17,7 @@ News
* Set the default value of `abbrev` to `False` (which controls whether or not abbreviated commands are allowed)
* With good tab-completion of command names, using abbreviated commands isn't particularly useful
* And it can create complications if you are't careful
* Improved implementation of `load` to use command queue instead of nested inner loop

0.7.4
-----
Expand Down
8 changes: 4 additions & 4 deletions tests/test_cmd2.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,16 +731,16 @@ def test_base_cmdloop_with_queue():
# Create a cmd2.Cmd() instance and make sure basic settings are like we want for test
app = cmd2.Cmd()
app.use_rawinput = True
app.intro = 'Hello World, this is an intro ...'
intro = 'Hello World, this is an intro ...'
app.cmdqueue.append('quit\n')
app.stdout = StdOut()

# Need to patch sys.argv so cmd2 doesn't think it was called with arguments equal to the py.test args
testargs = ["prog"]
expected = app.intro + '\n'
expected = intro + '\n'
with mock.patch.object(sys, 'argv', testargs):
# Run the command loop
app.cmdloop()
# Run the command loop with custom intro
app.cmdloop(intro=intro)
out = app.stdout.buffer
assert out == expected

Expand Down

0 comments on commit 891fe3f

Please sign in to comment.