paulirwin commented on code in PR #1084:
URL: https://github.com/apache/lucenenet/pull/1084#discussion_r1903172820
##########
src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs:
##########
@@ -3126,19 +3126,20 @@ private static void CleanupTemporaryFiles()
}
catch (Exception e) when (e.IsIOException())
{
- // Type suiteClass =
RandomizedContext.Current.GetTargetType;
- // if
(suiteClass.IsAnnotationPresent(typeof(SuppressTempFileChecks)))
- // {
- Console.Error.WriteLine("WARNING: Leftover undeleted
temporary files " + e.Message);
- return;
- // }
+ Type suiteClass = this.GetType();
+ if
(suiteClass.GetCustomAttribute<SuppressTempFileChecksAttribute>(inherit: true)
is { } suppressAttr)
Review Comment:
Changed to use
`RandomizedContext.CurrentContext.CurrentTest.TypeInfo?.Type.GetCustomAttribute<SuppressTempFileChecksAttribute>`
to ensure we're getting that attribute from the class instead of the method.
AttributeUsage should enforce that, but is a closer match to the Lucene logic
of looking at the type instead of the method.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]