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

Simplify unit testing api. #73241

Merged
merged 2 commits into from
Apr 26, 2024

Conversation

CyrusNajmabadi
Copy link
Member

No description provided.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Apr 26, 2024

[ExportWorkspaceService(typeof(IUnitTestingDocumentTrackingService), ServiceLayer.Default)]
[Shared]
internal sealed class DefaultUnitTestingDocumentTrackingService : IUnitTestingDocumentTrackingService
Copy link
Member Author

Choose a reason for hiding this comment

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

the IUnitTestingDocumentTrackingService only ever had a single, default, no-op impl (this type). Given that, it means this type+interface was utterly pointless. I removed it and unwound accordingly.


namespace Microsoft.CodeAnalysis.ExternalAccess.UnitTesting.SolutionCrawler;

internal static class IUnitTestingDocumentTrackingServiceExtensions
Copy link
Member Author

Choose a reason for hiding this comment

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

pointless extension since the underlying interface always returned null/empty

@@ -37,7 +37,6 @@ private abstract class AbstractUnitTestingPriorityProcessor : UnitTestingGlobalO
_lazyAnalyzers = lazyAnalyzers;

Processor = processor;
Processor._documentTracker.NonRoslynBufferTextChanged += OnNonRoslynBufferTextChanged;
Copy link
Member Author

Choose a reason for hiding this comment

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

no point registering for events that never fire.

{
base.Shutdown();

Processor._documentTracker.NonRoslynBufferTextChanged -= OnNonRoslynBufferTextChanged;
Copy link
Member Author

Choose a reason for hiding this comment

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

no need to unregister, so this override went away.

// process any available project work, preferring the active project.
var preferableProjectId = Processor._documentTracker.SupportsDocumentTracking
? Processor._documentTracker.TryGetActiveDocument()?.ProjectId
: null;
Copy link
Member Author

Choose a reason for hiding this comment

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

SupportsDocTracking was always fall, so this was always null.

@@ -120,12 +120,6 @@ protected override async Task ExecuteAsync()
// okay, there must be at least one item in the map
ResetStates();

if (await TryProcessOneHigherPriorityDocumentAsync().ConfigureAwait(false))
Copy link
Member Author

Choose a reason for hiding this comment

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

no concep of priority, so removed entirely.

{
if (!Processor._documentTracker.SupportsDocumentTracking)
{
return false;
Copy link
Member Author

Choose a reason for hiding this comment

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

this always returned false.

@CyrusNajmabadi CyrusNajmabadi changed the title WIP: Simplify unit testing api. Simplify unit testing api. Apr 26, 2024
@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review April 26, 2024 02:14
@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner April 26, 2024 02:14
@CyrusNajmabadi
Copy link
Member Author

@shyamnamboodiripad Just a heads up about this :) This just simplifies the amount of forked code we're maintaining.

@shyamnamboodiripad
Copy link
Contributor

@shyamnamboodiripad Just a heads up about this :) This just simplifies the amount of forked code we're maintaining.

Thanks for the heads up @CyrusNajmabadi 👍🏾 I don't foresee any problems based on a quick look. However, I have not been working too closely on the unit testing side recently so also tagging @AbhitejJohn and @y87feng as an FYI in case we notice any problems in feedback / triage.

@CyrusNajmabadi CyrusNajmabadi requested a review from ToddGrun April 26, 2024 06:20
@AbhitejJohn
Copy link
Contributor

@shyamnamboodiripad : Do you know what components we'd want to validate here? We'd want to loop in Artur if Live Unit Testing is involved as well.

@CyrusNajmabadi
Copy link
Member Author

@AbhitejJohn this is the system that sends you the stream of events you use to perform live test discovery. Note: all the above code is literally a no-op. It did nothing (it literally returned 'false' for a value, that made all of the following code do nothing).

So really in terms of validation, it just needs to be: does live test discovery still work?

@AbhitejJohn
Copy link
Contributor

gotcha. thanks @CyrusNajmabadi . Is there a val build we could use to try this out? @y87feng can help coordinate a validation.

@CyrusNajmabadi CyrusNajmabadi merged commit 97d18d1 into dotnet:main Apr 26, 2024
24 of 25 checks passed
@CyrusNajmabadi CyrusNajmabadi deleted the removeUnitTestingApi branch April 26, 2024 17:58
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Apr 26, 2024
@dibarbet dibarbet modified the milestones: Next, 17.11 P1 Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants