pytest_exploratory.ipython

Integration with IPython/Jupyter.

class PytestMagics(**kwargs)[source]

Bases: IPython.core.magic.Magics

IPython magics to control a pytest test session.

pytest_session(data)[source]

Start a pytest session.

This sets the pytest_session variable to an interactive.InteractiveSession instance.

pytest_context(context)[source]

Get into the given pytest context.

If the context is a full test name, the fixtures are setup and put into corresponding variables.

pytest_contextinfo(level)[source]

Show information about the current test context (currently just code).

Pass a number to show information about a parent context.

pytest_fixture(fixturenames)[source]

Load the given fixture(s) and add them to the variables.

For parametrized fixtures, you can give the parameter id between brackets, e.g. fixture_name[param_id].

pytest_fixtureinfo(fixturename)[source]

Show information about the fixture.

E.g.: %pytest_fixtureinfo tmpdir

pytest_fixtureinfodetail(fixturename)[source]

Show detailed information about the fixture.

E.g.: %pytest_fixtureinfodetail tmpdir

pytest_fixture_completer(ipython, event)[source]
pytest_runtests(dummy='')[source]

Run the tests in the current context.

shutdown_hook()[source]
pytest_session_stop(data='')[source]

Stop the pytest session.

This ensures that all fixtures are torn down.

magics = {'cell': {}, 'line': {'pytest_context': 'pytest_context', 'pytest_contextinfo': 'pytest_contextinfo', 'pytest_fixture': 'pytest_fixture', 'pytest_fixtureinfo': 'pytest_fixtureinfo', 'pytest_fixtureinfodetail': 'pytest_fixtureinfodetail', 'pytest_runtests': 'pytest_runtests', 'pytest_session': 'pytest_session', 'pytest_session_stop': 'pytest_session_stop'}}
registered = True
load_ipython_extension(ipython)[source]
unload_ipython_extension(ipython)[source]