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

Fix ClassCleanup not called when the first test in class is ignored #5070

Merged
merged 3 commits into from
Feb 19, 2025

Conversation

Youssef1313
Copy link
Member

@Youssef1313 Youssef1313 commented Feb 19, 2025

When the first test of a class is ignored (and the first test ever in the assembly), we will not call AssemblyInitialize, so IsAssemblyInitializeExecuted will be false.

However, in that case, we still want to call RunClassCleanup so that the test is marked as completed (see MarkTestComplete). Not marking the ignored test as completed is problematic, because later on when all tests in the class are executed, we will still be viewing remaining tests in the class, hence we will not call class cleanup.

Note that even with this change, we respect the case where all tests in class are ignored, and we will not call ClassCleanup. The logic in ExecuteClassCleanup handles the case when class init wasn't called.

Fixes #5062

@Youssef1313
Copy link
Member Author

/backport to rel/3.8

Copy link
Contributor

Started backporting to rel/3.8: https://github.com/microsoft/testfx/actions/runs/13408191594

Evangelink
Evangelink previously approved these changes Feb 19, 2025
Copy link
Member

@Evangelink Evangelink left a comment

Choose a reason for hiding this comment

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

Suggesting a comment on the test so we don't change order without noticing impact

@Youssef1313 Youssef1313 enabled auto-merge (squash) February 19, 2025 08:52
@Youssef1313 Youssef1313 merged commit 615efc2 into microsoft:main Feb 19, 2025
8 checks passed
@Youssef1313 Youssef1313 deleted the fix-classcleanup-not-called branch February 19, 2025 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants