pytest_notebook.plugin module#
pytest plugin configuration.
For more information on writing pytest plugins see:
- class pytest_notebook.plugin.JupyterNbCollector(*k, **kw)[source]#
Bases:
File
This class represents a pytest collector object for Jupyter Notebook files.
A collector is associated with a .ipynb file and collects it for testing.
- _nodeid#
- _store#
- config: Config#
The pytest config object.
- fspath: LocalPath#
A
LEGACY_PATH
copy of thepath
attribute. Intended for usage for methods not migrated topathlib.Path
yet, such asItem.reportinfo()
. Will be deprecated in a future release, prefer usingpath
instead.
- parent#
The parent collector node.
- session: Session#
The pytest session this node is part of.
- class pytest_notebook.plugin.JupyterNbTest(*k, **kw)[source]#
Bases:
Item
This class represents a pytest test invocation for a Jupyter Notebook file.
- _nodeid#
- _store#
- config: Config#
The pytest config object.
- fspath: LocalPath#
A
LEGACY_PATH
copy of thepath
attribute. Intended for usage for methods not migrated topathlib.Path
yet, such asItem.reportinfo()
. Will be deprecated in a future release, prefer usingpath
instead.
- parent#
The parent collector node.
- repr_failure(exc_info)[source]#
Handle exception raised by
self.runtest()
.- Parameters:
exc_info – see https://docs.pytest.org/en/latest/reference.html#_pytest._code.ExceptionInfo
- session: Session#
The pytest session this node is part of.
- class pytest_notebook.plugin.NotSet[source]#
Bases:
object
Class to indicate a configuration value was not set.
- pytest_notebook.plugin.gather_config_options(pytestconfig)[source]#
Gather all options, from command-line and ini file.
Note: command-line set options are prioritised over ini file ones.
- pytest_notebook.plugin.nb_regression(pytestconfig)[source]#
Fixture to execute a Jupyter Notebook, and test its output is as expected.
- pytest_notebook.plugin.pytest_addoption(parser)[source]#
Add pytest commandline and configuration file options.
- pytest_notebook.plugin.pytest_collect_file(path, parent)[source]#
Collect Jupyter notebooks using the specified pytest hook.
- pytest_notebook.plugin.pytest_report_header(config)[source]#
Add header information for pytest execution.