def METHOD_NAME(self, mocker):
    remove = mocker.patch("os.remove")
    path_exists = mocker.patch("os.path.exists")
    remove.side_effect = OSError()
    path_exists.return_value = True
    with pytest.raises(
        Exception, match=r".*socket already in use: sampleSocketName.9999.*"
    ):
        TorchModelServiceWorker(
            "unix", self.socket_name, None, None, metrics_config_path
        )