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

Allow AssemblyCleanup/ClassCleanup to have TestContext parameter #4387

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Youssef1313
Copy link
Member

@Youssef1313 Youssef1313 commented Dec 18, 2024

Fixes #4233

TODOs:

  • Add tests
  • Update analyzers and add analyzer tests

@Youssef1313 Youssef1313 marked this pull request as draft December 18, 2024 14:10
@Youssef1313 Youssef1313 requested a review from Copilot December 18, 2024 15:24
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 5 out of 9 changed files in this pull request and generated 2 comments.

Files not reviewed (4)
  • src/Adapter/MSTestAdapter.PlatformServices/PublicAPI/PublicAPI.Unshipped.txt: Language not supported
  • src/Adapter/MSTest.TestAdapter/Execution/ClassCleanupManager.cs: Evaluated as low risk
  • src/Adapter/MSTest.TestAdapter/Execution/TestAssemblyInfo.cs: Evaluated as low risk
  • src/Adapter/MSTest.TestAdapter/Execution/TestExecutionManager.cs: Evaluated as low risk
Comments suppressed due to low confidence (3)

src/Adapter/MSTest.TestAdapter/Execution/TestClassInfo.cs:494

  • Passing null! for TestContext can lead to a NullReferenceException if the method expects a TestContext parameter. Ensure a valid TestContext is passed.
ClassCleanupException = classCleanupMethod is not null ? InvokeCleanupMethod(classCleanupMethod, BaseClassCleanupMethods.Count, null!) : null;

src/Adapter/MSTest.TestAdapter/Execution/TestClassInfo.cs:499

  • Passing null! for TestContext can lead to a NullReferenceException if the method expects a TestContext parameter. Ensure a valid TestContext is passed.
ClassCleanupException = InvokeCleanupMethod(classCleanupMethod, baseClassCleanupQueue.Count, null!);

src/Adapter/MSTest.TestAdapter/Execution/UnitTestRunner.cs:367

  • The new ForceCleanup method signature should be covered by tests to ensure that the sourceLevelParameters and logger are correctly passed and utilized.
internal void ForceCleanup(IDictionary<string, object?> sourceLevelParameters, IMessageLogger logger) => ClassCleanupManager.ForceCleanup(_typeCache, sourceLevelParameters, logger);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow AssemblyCleanup and ClassCleanup methods to accept TestContext object
1 participant