summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* Added tab completion exampleKevin Van Brunt2018-03-021-7/+7
|
* Added unit tests for index based completionKevin Van Brunt2018-03-021-4/+48
|
* Added unit tests for flag based completionKevin Van Brunt2018-03-021-9/+61
|
* Sorting all completion results. Added unit tests for help command.Kevin Van Brunt2018-03-021-5/+35
|
* Fixed unit tests that call completeKevin Van Brunt2018-03-021-10/+135
|
* Corrected tab completion of subcommands.Kevin Van Brunt2018-03-021-46/+0
|
* Fixed typoKevin Van Brunt2018-03-011-1/+1
|
* Fixed more unit testsKevin Van Brunt2018-03-011-19/+16
|
* Fixed unit testsKevin Van Brunt2018-03-011-10/+11
|
* Revert to old attribute names for multilineCommands and excludeFromHistory ↵Todd Leonhardt2018-02-271-6/+6
| | | | | | | to prevent breaking change Also: - Reverted multilineCommands and shortcuts to class variables to prevent other breaking changes
* Converted a few class variables into instance variablesTodd Leonhardt2018-02-231-18/+18
| | | | | | | | | | | | | | | | Now that users can nest instances of cmd.Cmd2 to support creating sub-menus, we should need to be more careful about class vs instance variables to prevent potential problems. This converts the following former class variables into instance variables: - multiline_commands - shortcuts - exclude_from_help - exclude_from_history In the process, a couple camelCase variable names got converted to pep8_compliant names. There may be a few other class variables which should be converted to instance variables. But at the very least, this is a good start. This closes #273.
* Removed an assertion which will fail if your home directory is emptykotfu2018-02-201-5/+0
| | | | NixOS build and packaging system builds with a fake $HOME which has no contents. This assertion will fail in those cases, and doesn’t really test the completion code anyway.
* Flag the pexpect unit test of the persistent history to only run on macOSTodd Leonhardt2018-02-091-2/+3
| | | | | | - The Windows pexpect API is different from macOS or Linux - On Travis CI, the test behaves as if readline isn't working on those machines - The test runs fine when run on my system (on either macOS or Linux)
* Skip the pexpect-based unit test on Windows due to the pexpect API being ↵Todd Leonhardt2018-02-091-0/+2
| | | | different there
* Make sure pexpect uses same version of Python to spawn persistent history ↵Todd Leonhardt2018-02-091-4/+9
| | | | example
* Try increasing timeout to see if it fixes unit test on at least some platformsTodd Leonhardt2018-02-091-2/+2
|
* First past at unit test for persistent history featureTodd Leonhardt2018-02-091-0/+27
| | | | | | Added pexpect to modules required for running unit tests. This opens the door for carefully crafted complex unit tests to verify intricate behavior. Tests like this are somewhat painful to write and slow to execute. However, they can enable testing complicated interactive behavior that we otherwise probably would not be able to test.
* Added optional persistent readline history featureTodd Leonhardt2018-02-081-1/+1
| | | | | | | | | | | | - Including an example and info in the Sphinx docs Also: - Created CHANGELOG entry for 0.8.1 release - Added info to README about new sub-menu feature - Bumped version to 0.8.1 TODO: - Added a unit test for the persistent readline history feature
* Added separate test fixture for SecondLevel app by itselfTodd Leonhardt2018-02-071-4/+11
|
* Attempt to fix unit testsTodd Leonhardt2018-02-071-31/+55
|
* Added tests for submenuCalvin Lobo2018-02-041-0/+107
|
* help command temporarily redirects sys.stdout and sys.stderr to self.stdout ↵Todd Leonhardt2018-01-223-47/+29
| | | | | | | | for argparse commands In order to make "help" behave more consistently for decorated and undecorated commands, argparse output is temporarily redirected to self.stdout. So doing "help history" is similar to "help load". However, when using the "-h" with argparse commands without using the "help" command, the output from argparse isn't redirected to self.stdout. Fixing this would be rather difficult and would essentially involve creating a pyparsing rule to detect it at the parser level.
* Renamed @with_argument_parser decorator to @with_argparserTodd Leonhardt2018-01-212-11/+11
| | | | | Also: - Reanamed foo and bar subcommand methods to base_foo and base_bar
* History enhancementsTodd Leonhardt2018-01-201-3/+5
| | | | | | | | | | History changes: - Unknown commands are no longer saved in the history - history command now has a -t option to generate a transcript based on commands in the history Also: - Moved examples transcripts from examples to examples/transcripts - Added a new transcript for use with the pirate.py example
* Added unit tests for newly-overridden complete() methodTodd Leonhardt2018-01-201-0/+120
| | | | Also added a section on Sub-commands to the documentation.
* Added unit tests for sub-commandsTodd Leonhardt2018-01-202-0/+189
|
* Added links to docs and examples to CHANGELOG.mdTodd Leonhardt2018-01-201-1/+1
| | | | Also bumped version to 0.8.0.
* Fixed unit testsTodd Leonhardt2018-01-203-19/+34
| | | | Updated unit tests due to changes in how help is output for commands decorated with an argparse ArgumentParser.
* Simplified a few argparse examples and fixed some incorrect documentationTodd Leonhardt2018-01-171-2/+2
| | | | | | I eliminated a few "narg=1" configurations so that a single str value is returned instead of a List[str]. I also reworded some documentation which was no longer correct after the last commit which made "history command" have the same help text as "command -h" when using one of the two argparse decorators.
* Improved how new argparse-based decorators provide helpTodd Leonhardt2018-01-172-2/+6
| | | | | | Now "help command_name" and "command_name -h" provide exactly the same text. The function docstring for the "do_*" command sets and overrides the ArgumentParser "description" if the docstring is not empty.
* Cleanup of documentation and examplesTodd Leonhardt2018-01-171-7/+1
| | | | Removed usage of and reference to attributes and commands which have now been removed.
* do_edit() no longer edits history, just files #252kotfu2018-01-163-76/+0
|
* Remove do_save() and do_run() for #252kotfu2018-01-164-112/+12
|
* tweak unit tests for history #252kotfu2018-01-151-1/+1
|
* Implement -o, -r, and -e options for issue #252Jared Crapo2018-01-152-3/+51
|
* Fix test_base_show_readonly unit test on WindowsTodd Leonhardt2018-01-151-0/+1
|
* cmdenvironment command has been removed and its functionality now exists as ↵Todd Leonhardt2018-01-154-29/+27
| | | | a -a/--all option to the set command
* Fixed the test_transcript unit test when run with the from_cmdloop.txt inputTodd Leonhardt2018-01-151-2/+2
|
* show command has been removedTodd Leonhardt2018-01-154-20/+18
| | | | | | It's functionality has been moved inside the set command. The set command now uses an argparse parser.
* Made test_echo unit test robust to changes in expected value of "help history"Todd Leonhardt2018-01-151-1/+1
|
* Fixed expected value of "help history" for unit testsTodd Leonhardt2018-01-151-9/+13
|
* __relative_load command is now hidden from help menu by defaultTodd Leonhardt2018-01-154-13/+8
|
* Added a unit testTodd Leonhardt2018-01-151-0/+20
|
* Renamed new decorator to @with_argparser_and_unknown_args to make it more ↵Todd Leonhardt2018-01-151-1/+1
| | | | descriptive
* Changed @with_argument_parser to only pass single argument to commandsTodd Leonhardt2018-01-151-48/+26
| | | | Also added another @with_argparser_and_list decorator that uses argparse.parse_known_args to pass two arguments to a command: both the argparse output and a list of unknown/unmatched args.
* Made a couple cleanup changesTodd Leonhardt2018-01-153-24/+30
| | | | | | | | | 1) cmd2 no longer imports make_option from optparse - test files and examples now import this directly - this helps emphasize that this old optparse methodology of adding options to commands is deprecated 2) All argparsers have been given custom names instead of just "argparser" - this helps with readability and maintainability, especially with IDE renaming and such
* Fixed base_invalid_option unit testTodd Leonhardt2018-01-151-3/+2
| | | | argparse output for invalid option has different text and goes to stderr
* Fixed test_echo unit testTodd Leonhardt2018-01-151-1/+1
| | | | This one depends on the help text for history
* Fixed do_history unit tests and implementationTodd Leonhardt2018-01-151-9/+10
|
* remove use_argument_list attributekotfu2018-01-141-34/+0
|