[serve] Clean up kv store file, skip on windows (#19194)

This commit is contained in:
Edward Oakes 2021-10-08 12:30:48 -05:00 committed by GitHub
parent 44b0b6eb20
commit 93bcea7bdd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,3 +1,5 @@
import os
import sys
import time
from typing import Any, Dict, List, Optional, Tuple
from unittest.mock import patch, Mock
@ -1859,6 +1861,9 @@ def mock_backend_state_manager(
yield backend_state_manager, timer, goal_manager
# Clear checkpoint at the end of each test
kv_store.delete(CHECKPOINT_KEY)
if sys.platform != "win32":
# This line fails on windows with a PermissionError.
os.remove("test_kv_store.db")
def test_shutdown(mock_backend_state_manager):
@ -1974,5 +1979,4 @@ def test_resume_backend_state_from_replica_tags(mock_backend_state_manager):
if __name__ == "__main__":
import sys
sys.exit(pytest.main(["-v", "-s", __file__]))