Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added DisposeAfterSuite/DisposeAfterTest feature to test framework #1096

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

NightOwl888
Copy link
Contributor

  • You've read the Contributor Guide and Code of Conduct.
  • You've included unit or integration tests for your change, where applicable.
  • You've included inline docs for your change, where applicable.
  • There's an open issue for the PR that you are making. If you'd like to propose a change, please open an issue to discuss the change or find an existing issue.

Added DisposeAfterSuite/DisposeAfterTest feature to test framework

Fixes #1094

Description

This adds the LuceneTestCase.DisposeAfterTest() and LuceneTestCase.DisposeAfterSuite() methods to the test framework that exist in Lucene 4.8.0.

It also removes the LuceneTestCase.SuiteFailureMarker property that wasn't implemented. NUnit already tracks the result state of the tests in NUnit.Framework.Internal.TestExectionContext.CurrentContext.TestResult.ResultState and NUnit.Framework.TestContext.CurrentContext.Result.Outcome in a context-sensitive and thread safe manner, so there is no need to reinvent the wheel with this. For the same reason, we don't need the TestFailureMarker property or TestRuleMarkFailure class, which are all part of this feature.

The new feature also revealed that there were some directories that were not being disposed in Lucene.Net.Tests.Grouping which were also addressed.

For some reason TestFsts.TestRealTerms() does not reliably cleanup its line file docs temp file on Windows, so this adds the [SuppressTempFileChecks] attribute to suppress the issue when it happens (for now). At some point we should have a look at this, but it is not a blocker for the release.

…st() and DisposeAfterSuite() and removed TestMarkerFailure and SuiteMarkerFailure, since this info is already available through NUnit's TestExecutionContext.
…omments to indicate why we don't need this class in .NET. It is not sensible to have it because result state is already tracked by NUnit and is context sensitive.
…Writer, and IndexReader were not being disposed in any of these tests. Not closing the wrapped reader was being detected by the test framework as a problem and casing it to fail the test run, so added using statements to each of these instances so they will be cleaned up at the end of each test.
… caused any failure, so we can debug more easily.
…to ignore the fact that the LineDocsFile is not being deleted.
…domizedtesting and is not exposed publicly by Lucene.
@NightOwl888 NightOwl888 added the notes:new-feature A new feature label Jan 12, 2025
@NightOwl888 NightOwl888 requested a review from paulirwin January 12, 2025 05:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notes:new-feature A new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add DisposeAfterSuite/DisposeAfterTest functionaltiy to the test framework
1 participant