Jupyter Core plugin#

The following plugin is useful for setting up a test environment for Jupyter extensions and applications.

To use this plugin, install the dependencies for this plugin:

pip install 'pytest-jupyter[core]'

and list the plugin in the conftest.py file at the root of your project’s test directory.

Fixtures#

Fixtures for use with jupyter core and downstream.

echo_kernel_spec(jp_kernel_dir)#

Install a kernel spec for the echo kernel.

jp_asyncio_loop()#

Get an asyncio loop.

jp_config_dir(tmp_path)#

Provides a temporary Jupyter config dir directory value.

jp_data_dir(tmp_path)#

Provides a temporary Jupyter data dir directory value.

jp_env_config_path(tmp_path)#

Provides a temporary Jupyter env config path value.

jp_env_jupyter_path(tmp_path)#

Provides a temporary Jupyter env system path value.

jp_environ(monkeypatch, tmp_path, jp_home_dir, jp_data_dir, jp_config_dir, jp_runtime_dir, echo_kernel_spec, jp_system_jupyter_path, jp_system_config_path, jp_env_jupyter_path, jp_env_config_path)#

Configures a temporary environment based on Jupyter-specific environment variables.

jp_home_dir(tmp_path)#

Provides a temporary HOME directory value.

jp_kernel_dir(jp_data_dir)#

Get the directory for kernel specs.

jp_runtime_dir(tmp_path)#

Provides a temporary Jupyter runtime dir directory value.

jp_system_config_path(tmp_path)#

Provides a temporary Jupyter config path value.

jp_system_jupyter_path(tmp_path)#

Provides a temporary Jupyter system path value.

pytest_pycollect_makeitem(collector, name, obj)#

Custom pytest collection hook.

pytest_pyfunc_call(pyfuncitem)#

Custom pytest function call hook.