Skip to content

Commit

Permalink
Add fixture for running tests with scheduler and job queue
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-eq authored and berland committed Dec 14, 2023
1 parent 174f548 commit 07818cf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ markers = [
"quick_only",
"requires_eclipse",
"requires_window_manager",
"scheduler",
"script",
"slow",
"unstable",
Expand Down
14 changes: 14 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,20 @@ def excepthook(cls, exc, tb):
monkeypatch.setattr(sys, "excepthook", excepthook)


@pytest.fixture(params=[False, True])
def try_queue_and_scheduler(request, monkeypatch):
should_enable_scheduler = request.param
scheduler_mark = request.node.get_closest_marker("scheduler")
assert scheduler_mark
if scheduler_mark.kwargs.get("skip") and should_enable_scheduler:
pytest.skip("Skipping running test with scheduler enabled")
monkeypatch.setattr(
FeatureToggling._conf["scheduler"], "is_enabled", should_enable_scheduler
)
yield
monkeypatch.undo()


def pytest_collection_modifyitems(config, items):
for item in items:
fixtures = getattr(item, "fixturenames", ())
Expand Down

0 comments on commit 07818cf

Please sign in to comment.