Repository navigation
test: fix ClassDataSourceTupleTests to exercise class-level tuple unwrapping - #7318
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Attribute and tuple test coverage tests/TUnit.TestProject/ClassDataSourceTupleTests.cs |
TupleDataSource now derives from Attribute and implements IDataSourceAttribute. The constructor-parameter test applies [TupleDataSource] directly. Both tuple tests declare [EngineTest(ExpectedResult.Pass)]. |
Estimated code review effort: 2 (Simple) | ~5 minutes
Change: Other · Severity of issue fixed: Low
Possibly related PRs
- thomhurst/TUnit#7319: This PR fixes a compilation failure reported as a blocker for this change, though it does not modify tuple unwrapping.
Merge Risk: 
Minimal · up to 1db04
-
The test changes align with the stated tuple data-source coverage and reported passing results.
Pre-merge checks: 
5
-
Full details: Linked Issues check
-
Explanation
Issue
#7184has one direct coding requirement set. The test must exercise class-level tuple unwrapping, pass, and carry [EngineTest(ExpectedResult.Pass)]. The reviewed head meets each requirement in tests/TUnit.TestProject/ClassDataSourceTupleTests.cs (diff against merge base 3847fb7):- TupleDataSource now derives from Attribute and implements IDataSourceAttribute. The class carries [AttributeUsage(AttributeTargets.Class)].
- ClassDataSourceTupleTests uses [TupleDataSource] directly. The [ClassDataSource<TupleDataSource>] usage is removed, so the attribute instance is no longer injected in place of the tuple rows.
- ClassDataSourceTupleTests has [EngineTest(ExpectedResult.Pass)]. EngineTest is defined in tests/TUnit.TestProject/Attributes/ExpectedPassEngineTest.cs, and the file adds the required using.
The test body is unchanged. The pass result is supported by the author's reported local runs (source-generated and --reflection, net10.0, 3/3). I did not execute the tests, so the runtime pass is author-reported evidence.
Full details: Out of Scope Changes check
-
Explanation
The whole-PR diff touches one file: tests/TUnit.TestProject/ClassDataSourceTupleTests.cs (+9/-3). Each change connects to
#7184or to the same tuple-unwrapping test scenario:- TupleDataSource base type and AttributeUsage change: required so that [TupleDataSource] can be applied directly (issue Expected section).
- [TupleDataSource] replaces [ClassDataSource<TupleDataSource>] on ClassDataSourceTupleTests: directly requested by
#7184. - [EngineTest(ExpectedResult.Pass)] on ClassDataSourceTupleTests: directly requested by
#7184. - [EngineTest(ExpectedResult.Pass)] on StaticMethodClassDataSourceTupleTests: not named in
#7184. It is a sibling test in the same file that exercises the same tuple-unwrapping path. The PR description and the PR objectives state this change explicitly. It enables CI for the same test category and does not alter unrelated behavior.
No unrelated files or refactors appear in the diff. Pipeline, rebase, and rerun events in the PR comments are not code changes.
Full details: Docstring Coverage
-
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files.
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
A rabbit checks the tuple row,
Then sees the class attribute flow.
Two tests now state the pass they seek,
Their expected results clear and neat.
The rabbit hops through green-lit code.
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
ReviewLooks good. The fix is correct: Two optional notes:
No blocking issues. |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
[Low impact] The PR appears safe to merge. SummaryFixes the tuple fixture so its data rows reach the constructor.
Reviews (2) · Last reviewed commit: "test: exercise class-level tuple unwrapp..." · Reviewed by Greptile |
|
Both reviewers approved head Update: blocker #7319 has merged ( Optional notes from the Claude review:
|
…sts (#7184) Apply TupleDataSource directly as an attribute instead of through ClassDataSource<T>, which injected the data-source object itself, and mark both tuple test classes with [EngineTest(ExpectedResult.Pass)]. Co-Authored-By: Claude <noreply@anthropic.com>
4b562bb to
1db04e7
Compare
|
@codex review |
ReviewThis is a small, test-only fix, and I think it's correct.
I have no blocking concerns. Optional: rename LGTM. |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Status: the earlier blocker #7319 has merged. Both reviewers approved the current head
|
ReviewSmall, test-only change. The diagnosis is correct:
Optional: if LGTM. |
Summary
ClassDataSourceTupleTestsalways failed withInvalidCastException.[ClassDataSource<TupleDataSource>]creates an instance ofTupleDataSourceand injects that instance, so the constructor received the data-source object andGetDataRowsAsyncnever ran.TupleDataSourcenow derives fromAttributeand is applied directly as[TupleDataSource], so its tuple rows reach the constructor and class-level tuple unwrapping is actually tested.ClassDataSourceTupleTestsandStaticMethodClassDataSourceTupleTestsnow carry[EngineTest(ExpectedResult.Pass)]so CI runs them.Validation
dotnet test -f net10.0intests/TUnit.TestProject, in source-generated and--reflectionmode:/*/TUnit.TestProject/ClassDataSourceTupleTests/*: 3/3 passed in both modes/*/TUnit.TestProject/StaticMethodClassDataSourceTupleTests/*: 1/1 passed in both modesCloses #7184
Summary by CodeRabbit