@@ -1093,6 +1093,8 @@ void test_using_cache() throws IOException {
10931093 assertThat (context .allIssues ()).isEmpty ();
10941094 assertThat (logTester .logs (Level .INFO ))
10951095 .contains ("The Python analyzer was able to leverage cached data from previous analyses for 1 out of 1 files. These files were not parsed." );
1096+ assertThat (writeCache .getData ())
1097+ .containsEntry (effectiveFileTypeCacheKey (inputFile .wrappedFile ().key ()), "MAIN" .getBytes (UTF_8 ));
10961098 }
10971099
10981100 @ Test
@@ -1202,6 +1204,8 @@ void test_typeshed_stub_cache_information_is_propagated() throws IOException {
12021204 byte [] bytes = writeCache .getData ().get (TYPESHED_MODULES_KEY );
12031205 Set <String > resolvedTypeshedModules = new HashSet <>(Arrays .asList (new String (bytes , StandardCharsets .UTF_8 ).split (";" )));
12041206 assertThat (resolvedTypeshedModules ).containsExactlyInAnyOrder ("math" );
1207+ assertThat (writeCache .getData ())
1208+ .containsEntry (effectiveFileTypeCacheKey (inputFile .wrappedFile ().key ()), "MAIN" .getBytes (UTF_8 ));
12051209 }
12061210
12071211 @ Test
@@ -1324,6 +1328,7 @@ void test_scan_without_parsing_fails_does_not_reexecute_successful_checks() {
13241328 readCache .put (importsMapCacheKey (inputFile .wrappedFile ().key ()), String .join (";" , Collections .emptyList ()).getBytes (StandardCharsets .UTF_8 ));
13251329 readCache .put (projectSymbolTableCacheKey (inputFile .wrappedFile ().key ()), serializedSymbolTable );
13261330 readCache .put (fileContentHashCacheKey (inputFile .wrappedFile ().key ()), inputFile .wrappedFile ().md5Hash ().getBytes (UTF_8 ));
1331+ readCache .put (effectiveFileTypeCacheKey (inputFile .wrappedFile ().key ()), "MAIN" .getBytes (UTF_8 ));
13271332 context .setPreviousCache (readCache );
13281333 context .setNextCache (writeCache );
13291334 context .setCacheEnabled (true );
@@ -1356,6 +1361,7 @@ void test_partial_scan_without_parsing() {
13561361 readCache .put (importsMapCacheKey (inputFile2 .wrappedFile ().key ()), String .join (";" , List .of ("file1.py" )).getBytes (StandardCharsets .UTF_8 ));
13571362 readCache .put (projectSymbolTableCacheKey (inputFile2 .wrappedFile ().key ()), serializedSymbolTable );
13581363 readCache .put (fileContentHashCacheKey (inputFile2 .wrappedFile ().key ()), inputFile2 .wrappedFile ().md5Hash ().getBytes (UTF_8 ));
1364+ readCache .put (effectiveFileTypeCacheKey (inputFile2 .wrappedFile ().key ()), "MAIN" .getBytes (UTF_8 ));
13591365 context .setPreviousCache (readCache );
13601366 context .setNextCache (writeCache );
13611367 context .setCacheEnabled (true );
@@ -1509,6 +1515,7 @@ void read_cpd_tokens_from_cache() throws IOException {
15091515 readCache .put (importsMapCacheKey (inputFile .wrappedFile ().key ()), String .join (";" , Collections .emptyList ()).getBytes (StandardCharsets .UTF_8 ));
15101516 readCache .put (projectSymbolTableCacheKey (inputFile .wrappedFile ().key ()), serializedSymbolTable );
15111517 readCache .put (fileContentHashCacheKey (inputFile .wrappedFile ().key ()), inputFile .wrappedFile ().md5Hash ().getBytes (UTF_8 ));
1518+ readCache .put (effectiveFileTypeCacheKey (inputFile .wrappedFile ().key ()), "MAIN" .getBytes (UTF_8 ));
15121519
15131520 TestWriteCache writeCache = new TestWriteCache ();
15141521 writeCache .bind (readCache );
@@ -1597,6 +1604,7 @@ void read_cpd_tokens_from_cache_corrupted_format() throws IOException {
15971604 readCache .put (importsMapCacheKey (inputFile .wrappedFile ().key ()), String .join (";" , Collections .emptyList ()).getBytes (StandardCharsets .UTF_8 ));
15981605 readCache .put (projectSymbolTableCacheKey (inputFile .wrappedFile ().key ()), serializedSymbolTable );
15991606 readCache .put (fileContentHashCacheKey (inputFile .wrappedFile ().key ()), inputFile .wrappedFile ().md5Hash ().getBytes (UTF_8 ));
1607+ readCache .put (effectiveFileTypeCacheKey (inputFile .wrappedFile ().key ()), "MAIN" .getBytes (UTF_8 ));
16001608
16011609 TestWriteCache writeCache = new TestWriteCache ();
16021610 writeCache .bind (readCache );
@@ -1670,6 +1678,7 @@ void cpd_tokens_failure_does_not_execute_checks_multiple_times() throws IOExcept
16701678 readCache .put (importsMapCacheKey (inputFile .wrappedFile ().key ()), String .join (";" , Collections .emptyList ()).getBytes (StandardCharsets .UTF_8 ));
16711679 readCache .put (projectSymbolTableCacheKey (inputFile .wrappedFile ().key ()), serializedSymbolTable );
16721680 readCache .put (fileContentHashCacheKey (inputFile .wrappedFile ().key ()), inputFile .wrappedFile ().md5Hash ().getBytes (UTF_8 ));
1681+ readCache .put (effectiveFileTypeCacheKey (inputFile .wrappedFile ().key ()), "MAIN" .getBytes (UTF_8 ));
16731682
16741683 TestWriteCache writeCache = new TestWriteCache ();
16751684 writeCache .bind (readCache );
0 commit comments