Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirwin committed Jan 5, 2025
1 parent e0ae7bf commit 5ca12ae
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -722,11 +722,11 @@ private static IList<string> LoadCoreDirectories()
/// </summary>
internal static TestRuleSetupAndRestoreClassEnv ClassEnvRule { get; } = new TestRuleSetupAndRestoreClassEnv();

// LUCENENET TODO
// LUCENENET TODO: Implement these rules
/// <summary>
/// Suite failure marker (any error in the test or suite scope).
/// </summary>
public static readonly /*TestRuleMarkFailure*/ bool SuiteFailureMarker = true; // Means: was successful
public static /*TestRuleMarkFailure*/ bool SuiteFailureMarker = true; // Means: was successful

///// <summary>
///// Ignore tests after hitting a designated number of initial failures. This
Expand Down Expand Up @@ -937,6 +937,10 @@ public virtual void TearDown()

if (result.ResultState == ResultState.Failure || result.ResultState == ResultState.Error)
{
// LUCENENET specific - Track that at least one test in the suite failed.
// LUCENENET TODO: finish implementation of RuleChains so this is not needed (#1088)
SuiteFailureMarker = false;

string message =
$$"""
{{result.Message}}
Expand Down Expand Up @@ -3089,7 +3093,7 @@ protected string GetFullMethodName([CallerMemberName] string memberName = "")
}

// LUCENENET specific - this is equivalent to TemporaryFilesCleanupRule in Lucene
private void CleanupTemporaryFiles()
private static void CleanupTemporaryFiles()
{
// Drain cleanup queue and clear it.
FileSystemInfo[] everything;
Expand Down Expand Up @@ -3126,8 +3130,7 @@ private void CleanupTemporaryFiles()
}
catch (Exception e) when (e.IsIOException())
{
Type suiteClass = this.GetType();
if (suiteClass.GetCustomAttribute<SuppressTempFileChecksAttribute>(inherit: true) is { } suppressAttr)
if (RandomizedContext.CurrentContext.CurrentTest.TypeInfo?.Type.GetCustomAttribute<SuppressTempFileChecksAttribute>(inherit: true) is { } suppressAttr)
{
Console.Error.WriteLine($"WARNING: Leftover undeleted temporary files (bugUrl: {suppressAttr.BugUrl}): {e.Message}");
return;
Expand Down

0 comments on commit 5ca12ae

Please sign in to comment.