@@ -20,31 +20,26 @@ def test_download_probeinterface_file():
2020
2121
2222def test_latest_commit_mechanism ():
23- download_probeinterface_file (manufacturer , probe_name , tag = None )
23+ _ = get_probe (manufacturer , probe_name )
2424 cache_folder = get_cache_folder ()
2525 latest_commit_file = cache_folder / "main" / "latest_commit.txt"
26- if latest_commit_file .is_file ():
27- latest_commit_file .unlink ()
28-
29- # first download
30- download_probeinterface_file (manufacturer , probe_name , tag = None )
3126 assert latest_commit_file .is_file ()
32- with open (latest_commit_file , "r" ) as f :
33- commit1 = f .read ().strip ()
34- assert len (commit1 ) == 40
3527
36- # second download should not change latest_commit.txt
37- download_probeinterface_file (manufacturer , probe_name , tag = None )
28+ # now we manually change latest_commit.txt to something else
29+ with open (latest_commit_file , "w" ) as f :
30+ f .write ("1234567890123456789012345678901234567890" )
31+
32+ # now we get the probe again and make sure the latest_commit.txt file is updated
33+ _ = get_probe (manufacturer , probe_name )
3834 assert latest_commit_file .is_file ()
3935 with open (latest_commit_file , "r" ) as f :
40- commit2 = f .read ().strip ()
41- assert commit1 == commit2
36+ latest_commit = f .read ().strip ()
37+ assert latest_commit != "123456789012345678901234567890123456789"
4238
4339
4440def test_get_from_cache ():
45- # TODO: fix this test!!!
46- remove_from_cache (manufacturer , probe_name )
47- probe = download_probeinterface_file (manufacturer , probe_name )
41+ download_probeinterface_file (manufacturer , probe_name )
42+ probe = get_from_cache (manufacturer , probe_name )
4843 assert isinstance (probe , Probe )
4944
5045 tag = get_tags_in_library ()[0 ]
0 commit comments