Skip to content

Commit

Permalink
Use monkeypatch for WorkerPool._sleep override.
Browse files Browse the repository at this point in the history
  • Loading branch information
derekpierre committed Aug 8, 2024
1 parent 2c9a5e9 commit 1c22001
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions tests/test_bucket_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@ def json(self):


@pytest.fixture(autouse=True)
def mock_worker_pool_sleep():

def mock_worker_pool_sleep(monkeypatch):
original = WorkerPool._sleep

def _sleep(worker_pool, timeout):
original(worker_pool, 0.01)
pass

WorkerPool._sleep = _sleep
monkeypatch.setattr(WorkerPool, "_sleep", _sleep)


def test_bucket_sampling_schema(get_random_checksum_address):
Expand Down
6 changes: 2 additions & 4 deletions tests/test_get_ursulas.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@


@pytest.fixture(autouse=True)
def mock_worker_pool_sleep():

def mock_worker_pool_sleep(monkeypatch):
original = WorkerPool._sleep

def _sleep(worker_pool, timeout):
original(worker_pool, 0.01)
pass

WorkerPool._sleep = _sleep
monkeypatch.setattr(WorkerPool, "_sleep", _sleep)


def test_get_ursulas_schema(get_random_checksum_address):
Expand Down

0 comments on commit 1c22001

Please sign in to comment.