1717
1818from codeflash .cli_cmds .console import console , logger , test_files_progress_bar
1919from codeflash .code_utils .code_utils import get_run_tmp_file , module_name_from_file_path
20- from codeflash .code_utils .compat import SAFE_SYS_EXECUTABLE , codeflash_cache_dir
20+ from codeflash .code_utils .compat import SAFE_SYS_EXECUTABLE , codeflash_cache_db
2121from codeflash .models .models import CodePosition , FunctionCalledInTest , TestsInFile , TestType
2222
2323if TYPE_CHECKING :
@@ -41,7 +41,7 @@ class TestFunction:
4141
4242class TestsCache :
4343 def __init__ (self ) -> None :
44- self .connection = sqlite3 .connect (codeflash_cache_dir / "tests_cache.db" )
44+ self .connection = sqlite3 .connect (codeflash_cache_db )
4545 self .cur = self .connection .cursor ()
4646
4747 self .cur .execute (
@@ -79,6 +79,7 @@ def insert_test(
7979 line_number : int ,
8080 col_number : int ,
8181 ) -> None :
82+ self .cur .execute ("DELETE FROM discovered_tests WHERE file_path = ?" , (file_path ,))
8283 test_type_value = test_type .value if hasattr (test_type , "value" ) else test_type
8384 self .cur .execute (
8485 "INSERT INTO discovered_tests VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)" ,
@@ -115,7 +116,7 @@ def get_tests_for_file(self, file_path: str, file_hash: str) -> list[FunctionCal
115116
116117 @staticmethod
117118 def compute_file_hash (path : str ) -> str :
118- h = hashlib .md5 (usedforsecurity = False )
119+ h = hashlib .sha256 (usedforsecurity = False )
119120 with Path (path ).open ("rb" ) as f :
120121 while True :
121122 chunk = f .read (8192 )
0 commit comments