Skip to content
Open
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
21 changes: 9 additions & 12 deletions tests/test_lock_manager.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) QuantCo and pydiverse contributors 2025-2025
# SPDX-License-Identifier: BSD-3-Clause

import sys
import threading
import time
from typing import Callable
Expand Down Expand Up @@ -91,7 +91,6 @@ def lm_2_task():
assert not t2.is_alive(), "Thread timed out"


@pytest.mark.parallelize
@pytest.mark.skipif(KazooClient is None, reason="requires kazoo")
def test_zookeeper():
from pydiverse.pipedag.backend.lock import ZooKeeperLockManager
Expand All @@ -111,7 +110,6 @@ def create_lock_manager():
)


@pytest.mark.parallelize
def test_filelock():
import tempfile
from pathlib import Path
Expand All @@ -126,21 +124,20 @@ def create_lock_manager():
_test_lock_manager(create_lock_manager)


@pytest.mark.parallelize
@pytest.mark.skipif(
sys.version_info >= (3, 13),
reason="We get deprecation warning in 3.13 for forking multithreaded process and "
"we see this test hanging in a way that cannot be caught by a timeout.",
)
def test_no_lock():
from pydiverse.pipedag.backend.lock import NoLockManager

def create_lock_manager():
return NoLockManager()

try:
with timeout(seconds=60):
with pytest.raises(RuntimeError):
_test_lock_manager(create_lock_manager)
pytest.fail("No lock manager MUST fail the lock manager tests")
except TimeoutError:
logger = structlog.get_logger(logger_name=__name__ + ".test_no_lock")
logger.info("Running without lock manage may hang")
with pytest.raises(RuntimeError):
_test_lock_manager(create_lock_manager)
pytest.fail("No lock manager MUST fail the lock manager tests")


@with_instances("postgres", "mssql", "ibm_db2")
Expand Down