Ejemplo n.º 1
0
    def test_lock_register_cleanup_removal(self, tmp_path: Path) -> None:
        lock = create_cleanup_lock(tmp_path)

        registry: List[Callable[..., None]] = []
        register_cleanup_lock_removal(lock, register=registry.append)

        (cleanup_func, ) = registry

        assert lock.is_file()

        cleanup_func(original_pid="intentionally_different")

        assert lock.is_file()

        cleanup_func()

        assert not lock.exists()

        cleanup_func()

        assert not lock.exists()
Ejemplo n.º 2
0
    def test_lock_register_cleanup_removal(self, tmp_path):
        from _pytest.pathlib import create_cleanup_lock, register_cleanup_lock_removal

        lock = create_cleanup_lock(tmp_path)

        registry = []
        register_cleanup_lock_removal(lock, register=registry.append)

        cleanup_func, = registry

        assert lock.is_file()

        cleanup_func(original_pid="intentionally_different")

        assert lock.is_file()

        cleanup_func()

        assert not lock.exists()

        cleanup_func()

        assert not lock.exists()
Ejemplo n.º 3
0
    def test_lock_register_cleanup_removal(self, tmp_path):
        from _pytest.pathlib import create_cleanup_lock, register_cleanup_lock_removal

        lock = create_cleanup_lock(tmp_path)

        registry = []
        register_cleanup_lock_removal(lock, register=registry.append)

        cleanup_func, = registry

        assert lock.is_file()

        cleanup_func(original_pid="intentionally_different")

        assert lock.is_file()

        cleanup_func()

        assert not lock.exists()

        cleanup_func()

        assert not lock.exists()