MCPcopy Create free account
hub / github.com/tox-dev/filelock / test_subclass_compatibility

Function test_subclass_compatibility

tests/test_filelock.py:784–815  ·  view source on GitHub ↗
(tmp_path: Path)

Source from the content-addressed store, hash-verified

782
783
784def test_subclass_compatibility(tmp_path: Path) -> None:
785 class MyFileLock(FileLock):
786 def __init__(
787 self,
788 lock_file: str | os.PathLike[str],
789 timeout: float = -1,
790 mode: int = 0o644,
791 thread_local: bool = True,
792 my_param: int = 0,
793 **kwargs: dict[str, Any], # noqa: ARG002
794 ) -> None:
795 super().__init__(lock_file, timeout, mode, thread_local, is_singleton=True)
796 self.blocking = True
797 self.my_param = my_param
798
799 lock_path = tmp_path / "a"
800 MyFileLock(str(lock_path), my_param=1)
801
802 class MySoftFileLock(SoftFileLock):
803 def __init__(
804 self,
805 lock_file: str | os.PathLike[str],
806 timeout: float = -1,
807 mode: int = 0o644,
808 thread_local: bool = True,
809 my_param: int = 0,
810 **kwargs: dict[str, Any], # noqa: ARG002
811 ) -> None:
812 super().__init__(lock_file, timeout, mode, thread_local, blocking=True, is_singleton=True)
813 self.my_param = my_param
814
815 MySoftFileLock(str(lock_path), my_param=1)
816
817
818@pytest.mark.parametrize("lock_type", [FileLock, SoftFileLock])

Callers

nothing calls this directly

Calls 2

MyFileLockClass · 0.85
MySoftFileLockClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…