Skip to content

Add ConditionalAssemblyAttribute - #16820

Merged
AndriySvyryd merged 8 commits into
mainfrom
copilot/add-conditionalassemblyattribute-tests
Jul 16, 2026
Merged

AndriySvyryd merged 8 commits into
mainfrom
copilot/add-conditionalassemblyattribute-tests

Conversation

Copilot AI commented May 15, 2026 •

Copy link
Copy Markdown
Contributor

Adds ConditionalAssemblyAttribute into the V3-only project, and adds a dedicated test project that exercises the attribute end-to-end via the runner.

Changes

  • Add to V3 sources: src/Microsoft.DotNet.XUnitV3Extensions/src/ConditionalAssemblyAttribute.cs.
  • New end-to-end test project Microsoft.DotNet.XUnitV3Extensions.AlwaysFalseConditionalAssembly.Tests: a single Assert.Fail test plus an assembly-level [ConditionalAssembly(typeof(Conditions), nameof(Conditions.AlwaysFalse))]. The runner is configured with --filter-not-trait "category=failing" --ignore-exit-code 8 so the project passes only when the attribute correctly stamps every test with the category=failing trait; if the attribute regresses, the failing test runs and breaks the build.
  • Project layout: Lives in the existing tests/ folder beside the existing tests csproj (no new folder). Compile globbing is scoped (EnableDefaultCompileItems=false + explicit <Compile Include> on the new project, <Compile Remove> on the sibling) so the assembly attribute and failing test do not bleed across projects.
  • Registered in Arcade.slnx.
  • Helix wiring: Registered in tests/UnitTests.proj as an XUnitV3Project (with the trait filter / ignore-exit-code passed via the Arguments metadata that CreateXUnitV3WorkItems appends to the Helix command line) and excluded from the XUnitProject glob, so PR validation runs it via the V3 self-hosting path with the same filter applied locally.

To double check:

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Moves ConditionalAssemblyAttribute into the xUnit v3 extensions project and adds tests intended to validate its behavior, including an end-to-end project with an always-false assembly condition.

Changes:

  • Adds V3-only ConditionalAssemblyAttribute.
  • Adds direct unit coverage for assembly-level condition behavior.
  • Adds a new always-failing test project meant to validate trait filtering end-to-end.

Reviewed changes

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

Show a summary per file
File Description
src/Microsoft.DotNet.XUnitV3Extensions/src/ConditionalAssemblyAttribute.cs Adds the V3 assembly-level conditional trait attribute.
src/Microsoft.DotNet.XUnitV3Extensions/tests/ConditionalAttributeTests.cs Adds unit tests for multiple/no/missing condition members and constructor storage.
src/Microsoft.DotNet.XUnitV3Extensions/tests/AlwaysFalseConditionalAssemblyTests.cs Adds the intentionally failing test guarded by an always-false assembly condition.
src/Microsoft.DotNet.XUnitV3Extensions/tests/Microsoft.DotNet.XUnitV3Extensions.AlwaysFalseConditionalAssembly.Tests.csproj Defines the new focused V3 test project and runner arguments.
src/Microsoft.DotNet.XUnitV3Extensions/tests/Microsoft.DotNet.XUnitV3Extensions.Tests.csproj Excludes the new test file from the sibling test project.
Arcade.slnx Adds the new test project to the solution.

Comment thread Arcade.slnx Resolved
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Copilot AI requested a review from AndriySvyryd May 15, 2026 00:37
@AndriySvyryd
AndriySvyryd marked this pull request as ready for review May 15, 2026 00:37
@AndriySvyryd AndriySvyryd changed the title Move ConditionalAssemblyAttribute to V3 project and add end-to-end test Add ConditionalAssemblyAttribute May 15, 2026
Copilot AI review requested due to automatic review settings May 19, 2026 17:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

@AndriySvyryd
AndriySvyryd requested a review from wtgodbe June 9, 2026 19:16
Copilot AI review requested due to automatic review settings July 13, 2026 20:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Comment thread tests/UnitTests.proj Resolved
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Copilot AI review requested due to automatic review settings July 13, 2026 20:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comment thread tests/UnitTests.proj Resolved
Copilot AI requested review from Copilot and removed request for Copilot July 14, 2026 00:52
@AndriySvyryd
AndriySvyryd merged commit 27ef2d1 into main Jul 16, 2026
10 checks passed
@AndriySvyryd
AndriySvyryd deleted the copilot/add-conditionalassemblyattribute-tests branch July 16, 2026 23:43
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 18, 2026
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.

4 participants