This commit is contained in:
Thomas Grainger 2023-10-19 18:31:45 +01:00
parent db62b80e8d
commit 662fc9c012
No known key found for this signature in database
GPG Key ID: DDA48B5C47FBC8C8
1 changed files with 8 additions and 0 deletions

View File

@ -197,6 +197,14 @@ the test. You can also skip based on the version number of a library:
The version will be read from the specified
module's ``__version__`` attribute.
Sometimes importing a module can fail due to an exception, if you want to
only skip if the module does not exist pass ModuleNotFoundError as the
``exc`` kwarg:
.. code-block:: python
docutils = pytest.importorskip("docutils", exc=ModuleNotFoundError)
Summary
~~~~~~~