| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| |
|
|
|
|
| |
Mocks of six.moves.input() and sys.stdin.isatty() now use either a context manager or a decorator. These wrappers make sure to put the functions back to their unmocked values when the test is done.
This change appears to have solved the undeterministic test results.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
When ‘pytest -n8’ parallelizes the test execution, hacking sys.stdin to some other file descriptor yields unpredictable results
|
| |
|
|
| |
if we are on a pipe, we have to echo the prompt only after we read and are not at EOF.
|
| |
|
|
|
|
| |
command and echo is True
Previously just the command get printed. Now the prompt and the command gets printed.
|
| |
|
|
|
|
| |
regexes
Also bumped version from 0.7.7a to 0.7.7 in preparation for eventual next release.
|
| |\ |
|
| | |
| |
| |
| | |
Also fixed a 2nd unrelated unit test which sometimes failed on Windows, depending on what tools were installed or not.
|
| | |
| |
| |
| |
| |
| | |
parsing related to spaces and quotes
The recent change of edit to allow spaces means that it can benefit from the better argument parsing cmd2 has for commands implemented using the @options decorator.
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | |
| |
| |
| | |
Escapes of slashes don’t work yet.
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| |/ |
|
| |
|
|
| |
This is so that non-essential info which isn't directly associated with command output, such as time elapsed while executing a command, won't redirect when command output is redirected using >, >>, or |.
|
| | |
|
| | |
|
| |
|
|
| |
If feedback_to_output is false, .pfeedback() now sends messages to stderr instead of stdout.
|
| |
|
|
| |
This is to help distinguish latest code in GitHub from a version installed via pip from PyPI
|
| |
|
|
|
|
| |
- poutput() can now take any argument convertible to a str via '{}'.format() instead of only str
- postparsing_postcmd() automatically runs a 'stty sane' on POSIX OSes to handle those cases of your terminal getting in a messed up state if you do something like pipe to a terminal command like "less" and then improperly quit out of it with a <Ctrl>-C instead of properly using "q"
- In _restore_output(), immeditelly restore stdout state in a finally block after closing the temporary one used for redirection/piping
|
| | |
|
| |
|
|
|
|
|
|
| |
Open them in text mode in Python 3 so self.stdout.write() expects normal Python 3 (unicode) strings.
Open them in binary mode in Python 2 so self.stdout.write() expects normal Python 2 (byte) strings.
Also fixed a unit test mocking issue on Python 2 to account for the fact that Python 2.7 requires the subprocess32 module instead of subprocess.
|
| |
|
|
|
|
|
|
|
|
| |
Now a real pipe is created to a subprocess. This has many advantages and should "just work" like intended with all commands.
One downside is to work properly on Python 2.7, it requires the subprocess32 module which is the subprocess module from Python 3.2 backported to Python 2.7. Another downside, is that unit testing the feature is now more difficult.
This still needs to be tested for compatibility across all OSes and supported versions of Python.
The user needs to be careful if designing multi-threaded cmd2 applications that do command processing in other threads and those threads can make calls to self.stdout.write to put in a try/except to catch Broken Pipe errors which can occur for long running commands if the user closes the shell subprocess before the command is finished.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
| |
Also:
- Added a couple unit tests related to case-sensitive vs case-insensitive parsing
- Updated CHANGES.md
|
| |\
| |
| | |
Avoid conflict the `eg` tool from go-tools
|
| | |
| |
| |
| |
| | |
With go-tools installed there is an `eg` command in system search path.
Let's add an additional character to avoid the test failure.
|
| |\ \
| | |
| | | |
Remove unused import in tests
|
| | |/ |
|
| |/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Without this patch, running tests like test_edit_number before
test_default_to_shell_good in the same process will trigger
this error:
```
_______________________________________________________________ test_default_to_shell_good ________________________________________________________________
capsys = <_pytest.capture.CaptureFixture object at 0x7f7e90103898>
def test_default_to_shell_good(capsys):
app = cmd2.Cmd()
app.default_to_shell = True
line = 'ls'
statement = app.parser_manager.parsed(line)
retval = app._default(statement)
assert not retval
out, err = capsys.readouterr()
> assert out == ''
E AssertionError: assert '*** Unknown syntax: ls \n' == ''
E - *** Unknown syntax: ls
tests/test_cmd2.py:840: AssertionError
```
Using monkeypatch fixture to restore os.system fixes the problem here.
|
| | |
|
| | |
|
| |
|
|
| |
Also updated CHANGES.md
|
| |
|
|
|
|
| |
requests
Also added some unit tests related to when default_to_shell is True
|
| | |
|
| |
|
|
| |
compatibility shim
|
| |
|
|
|
|
| |
The load command no longer spawns a nested main loop using _cmdloop(). It now simply adds commands to the cmdqueue. And after adding all commands in the script file, it adds the eos command.
The eos command simply pops the most recent script directory from the list of script directories.
|