Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip doctests if optional dependencies are not installed #8258

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions conftest.py
Expand Up @@ -36,6 +36,16 @@
except ImportError:
collect_ignore.append("dask/dataframe/io/orc/arrow.py")

try:
import tiledb # noqa: F401
except ImportError:
collect_ignore.append("dask/array/tiledb_io.py")

try:
import sqlalchemy # noqa: F401
except ImportError:
collect_ignore.append("dask/dataframe/io/sql.py")


def pytest_addoption(parser):
parser.addoption("--runslow", action="store_true", help="run slow tests")
Expand Down
8 changes: 4 additions & 4 deletions dask/cache.py
Expand Up @@ -13,19 +13,19 @@ class Cache(Callback):
Examples
--------

>>> cache = Cache(1e9)
>>> cache = Cache(1e9) # doctest: +SKIP

The cache can be used locally as a context manager around ``compute`` or
``get`` calls:

>>> with cache: # doctest: +SKIP
>>> with cache: # doctest: +SKIP
... result = x.compute()

You can also register a cache globally, so that it works for all
computations:

>>> cache.register()
>>> cache.unregister()
>>> cache.register() # doctest: +SKIP
>>> cache.unregister() # doctest: +SKIP
"""

def __init__(self, cache, *args, **kwargs):
Expand Down
4 changes: 2 additions & 2 deletions dask/diagnostics/profile.py
Expand Up @@ -307,8 +307,8 @@ class CacheProfiler(Callback):
example, the ``nbytes`` function found in ``cachey`` can be used to measure
the number of bytes in the cache.

>>> from cachey import nbytes
>>> with CacheProfiler(metric=nbytes) as prof:
>>> from cachey import nbytes # doctest: +SKIP
>>> with CacheProfiler(metric=nbytes) as prof: # doctest: +SKIP
... get(dsk, 'z')
22

Expand Down