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

Refactor default_worker_tasks fixture in pytest #215

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import pytest

from tests import tasks

@pytest.fixture
def default_worker_tasks(default_worker_tasks: set) -> set:
Copy link
Member

@Nusnus Nusnus Feb 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By receiving the set from "itself", you can populate the set in different fixture availability scopes to control which test has which tasks.

It's a feature not a bug :)

from tests import tasks

@pytest.fixture
def default_worker_tasks():
default_worker_tasks = set()
default_worker_tasks.add(tasks)
return default_worker_tasks
Loading