Skip to content

Commit

Permalink
add oversaturate_only mark
Browse files Browse the repository at this point in the history
  • Loading branch information
gjoseph92 committed Sep 2, 2022
1 parent e6a15ba commit 0f9034a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
26 changes: 20 additions & 6 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# https://pytest.org/latest/example/simple.html#control-skipping-of-tests-according-to-command-line-option
from __future__ import annotations

import math

import pytest

import dask

# Uncomment to enable more logging and checks
# (https://docs.python.org/3/library/asyncio-dev.html)
# Note this makes things slower and might consume much memory.
Expand All @@ -27,13 +30,24 @@ def pytest_addoption(parser):


def pytest_collection_modifyitems(config, items):
if config.getoption("--runslow"):
# https://pytest.org/latest/example/simple.html#control-skipping-of-tests-according-to-command-line-option
if skip_slow := not config.getoption("--runslow"):
# --runslow given in cli: do not skip slow tests
return
skip_slow = pytest.mark.skip(reason="need --runslow option to run")
skip_slow_marker = pytest.mark.skip(reason="need --runslow option to run")

if skip_oversaturate := math.isfinite(
dask.config.get("distributed.scheduler.worker_saturation")
):
skip_oversaturate_marker = pytest.mark.skip(
reason="need `distributed.scheduler.worker_saturation = inf` to run"
)

for item in items:
if "slow" in item.keywords:
item.add_marker(skip_slow)
if skip_slow and "slow" in item.keywords:
item.add_marker(skip_slow_marker)

if skip_oversaturate and "oversaturate_only" in item.keywords:
item.add_marker(skip_oversaturate_marker)

if "ws" in item.fixturenames:
item.add_marker(pytest.mark.workerstate)
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ markers =
gpu: marks tests we want to run on GPUs
leaking: ignore leaked resources; see pytest_resourceleaks.py for usage
workerstate: deterministic test for the worker state machine. Automatically applied to all tests that use the 'ws' fixture.
oversaturate_only: tests that only work/make sense to run if root task queuing is disabled
# pytest-timeout settings
# 'thread' kills off the whole test suite. 'signal' only kills the offending test.
Expand Down

0 comments on commit 0f9034a

Please sign in to comment.