Skip to content

Commit

Permalink
Merge pull request #76 from astronomy-commons/delucchi/mark-dask
Browse files Browse the repository at this point in the history
Require dask_client if not requested.
  • Loading branch information
delucchi-cmu authored Apr 27, 2023
2 parents 22f9064 + 0027fdc commit dcb225b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions tests/hipscat_import/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,27 @@ def dask_client():


def pytest_collection_modifyitems(items):
"""Modify dask unit tests to ignore event loop deprecation warnings and have a longer timeout"""
"""Modify dask unit tests to
- ignore event loop deprecation warnings
- have a longer timeout default timeout (5 seconds instead of 1 second)
- require use of the `dask_client` fixture, even if it's not requsted
Individual tests that will be particularly long-running can still override
the default timeout, by using an annotation like:
@pytest.mark.dask(timeout=10)
def test_long_running():
...
"""
for item in items:
timeout = None
for mark in item.iter_markers(name="dask"):
timeout = 3
timeout = 5
if "timeout" in mark.kwargs:
timeout = int(mark.kwargs.get("timeout"))
if timeout:
item.add_marker(pytest.mark.timeout(timeout))
item.add_marker(pytest.mark.usefixtures("dask_client"))
item.add_marker(pytest.mark.filterwarnings("ignore::DeprecationWarning"))


Expand Down

0 comments on commit dcb225b

Please sign in to comment.