Commit graph

4 commits

Author SHA1 Message Date
Peter Ye
259fbe540c
fix: do not append empty/comment-only input to history (#4822)
* add test for importing empty .xsh file

* test: empty lines do not get appended to history

prompt-toolkit needs its own test outside of test_base_shell.py because it uses a custom _push() method

* fix: do not append empty/comment-only input to history

Adds a compile_empty_tree argument to Execer.compile()
By default, the argument is `True`, and `compile()` returns a compiled `pass` statement for comment-only input.
When the argument is `False`, `compile()` returns `None` for comment-only input.

The base shell and prompt-toolkit shell use `compile_empty_tree = False` so that they get `None` as the compiled code and don't append the command to the history.

* add news

* fix tests
2022-05-26 17:50:08 +05:30
Anthony Scopatz
78cc184a15 test subpackage 2015-03-29 22:53:33 -05:00
Anthony Scopatz
08609ca0ca added relative import test 2015-03-29 18:29:56 -05:00
Anthony Scopatz
51bc86ab49 more robust loading / unloading 2015-03-29 18:25:11 -05:00