custom IPython shell

An extended shell for test selection

class interactive.shell.PytestShellEmbed(**kw)[source]

Bases: IPython.terminal.embed.InteractiveShellEmbed

Custom ip shell with a slightly altered exit message

init_history()[source]

Sets up the command history, and starts regular autosaves.

Note

A separate history db is allocated for this plugin separate from regular shell sessions such that only relevant commands are retained.

exit()[source]

Handle interactive exit. This method calls the ask_exit callback and if applicable prompts the user to verify the current test selection

class interactive.shell.SelectionMagics(shell=None, **kwargs)[source]

Bases: IPython.core.magic.Magics

Custom magics for performing multiple test selections within a single session

ns_eval(line)[source]

Evalutate line in the embedded ns and return result

add(line)[source]

Add tests from a test set to the current selection.

Usage:

add tt : add all tests in the current tree add tt[4] : add 5th test in the current tree add tt.tests[1:10] : add tests 1-9 found under the ‘tests’ module

remove(line, delim=', ')[source]

Remove tests from the current selection using a slice syntax using a ‘,’ delimiter instead of ‘:’.

Usage:

remove : remove all tests from the current selection remove -1 : remove the last item from the selection remove 1, : remove all but the first item (same as [1:]) remove ,,-3 : remove every third item (same as [::-3])

show(test_set)[source]

Show all currently selected test by pretty printing to the console.

Usage:

show: print currently selected tests
cache(line, ident='pytest/interactive')[source]

Store a set of tests in the pytest cache for retrieval in another session.

Usage:

cache: show a summary of names previously stored in the cache.

cache del <name>: deletes the named entry from the cache.

cache add <name> <target>: stores the named tests as target name.