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 error when resetting configurations in tear down phase #114468

Merged
merged 11 commits into from Feb 15, 2023

Conversation

fzyzcjy
Copy link
Contributor

@fzyzcjy fzyzcjy commented Nov 2, 2022

(This is WIP, since I want to see whether this change will make regression test fail or not) ready for review

Consider this simple example

import 'package:flutter/scheduler.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
  testWidgets('addTearDown should work', (tester) async { // <-- THIS FAILS
    timeDilation = 2;
    addTearDown(() => timeDilation = 1);
  });

  testWidgets('directly reset should work', (tester) async { // <-- this is ok
    timeDilation = 2;
    timeDilation = 1;
  });
}

It yields:

/Volumes/MyExternal/ExternalRefCode/flutter/bin/flutter --no-color test --machine --start-paused test/a.dart
Testing started at 09:50 ...

══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following assertion was thrown running a test:
The timeDilation was changed and not reset by the test.

When the exception was thrown, this was the stack:
#0      SchedulerBinding.debugAssertNoTimeDilation.<anonymous closure> (package:flutter/src/scheduler/binding.dart:662:9)
#1      SchedulerBinding.debugAssertNoTimeDilation (package:flutter/src/scheduler/binding.dart:665:6)
#2      TestWidgetsFlutterBinding._verifyInvariants (package:flutter_test/src/binding.dart:968:12)
#3      AutomatedTestWidgetsFlutterBinding._verifyInvariants (package:flutter_test/src/binding.dart:1433:11)
#4      TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:952:7)
<asynchronous suspension>

The test description was:
  addTearDown should work
════════════════════════════════════════════════════════════════════════════════════════════════════

Test failed. See exception logs above.
The test description was: addTearDown should work

In other words, we do not allow resetting configurations in addTearDown (or tearDown). Instead, we must do it at the end of the closure.

IMHO resetting things in addTearDown/tearDown is a commonly seen practice. For example, window.physicalSize can be reset in a tear-down function, and even Flutter test code inside the framework does so a lot of times. A quick search also shows that, such as this example, resetting in tear down holds even for other tests such as Python.

By disallowing so, Flutter devs may have a bit more friction when learning Flutter, since they may firstly write down code that follows common practice, realizing it does not work, and change it.

It is also inconsistent with other parts of the Flutter. As mentioned above, window.physicalSize can be reset in a tear-down function, but things like timeDilation cannot.

The PR can also make code a bit simpler. Originally, whenever writing setup code (e.g. timeDilation=2), we must put tear down code at the end of the function, and wrap with a try-finally. But with the PR, it can be put near the setup code, so it is a bit cleaner for code readers. By the way, this is also a bit like the "defer" keyword in go - something like configure(); defer reset(); other_functions() will let the reset be executed last.

In some cases, this seems to simplify code a lot. For example, in #113830 (comment), I have to introduce a weird timeDilation reset that seems to have no pairing timeDilation modification (and cause confusion of readers - even code reviewers). With this PR, the reset will be put to the next line of modification, so it is clear.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard bot added a: tests "flutter test", flutter_test, or one of our tests framework flutter/packages/flutter repository. See also f: labels. labels Nov 2, 2022
@fzyzcjy fzyzcjy changed the title [WIP] Fix error when resetting configurations in tear down phase Fix error when resetting configurations in tear down phase Nov 2, 2022
@fzyzcjy fzyzcjy marked this pull request as ready for review November 2, 2022 06:39
@goderbauer
Copy link
Member

(This is WIP, since I want to see whether this change will make regression test fail or not)

Do you still have further plans for this? Or did it achieve its goal and can be closed?

@fzyzcjy
Copy link
Contributor Author

fzyzcjy commented Nov 15, 2022

Oh it is ready for review

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Copy link
Contributor

@pdblasi-google pdblasi-google left a comment

Choose a reason for hiding this comment

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

Looks like you found another interesting case here. I think you've got the right idea for fixing it, but I think we should take it further.

I did a bit of testing and we should be able to move the entire if statement starting at line 938 (if (_pendingExceptionDetails == null)) into an addTearDown that we register where you've got yours now.

That'll cover your use case, plus many other verifications that would run into a similar issue. And it wouldn't require splitting up the invariant verification methods as you've done here.

packages/flutter_test/lib/src/binding.dart Outdated Show resolved Hide resolved
@fzyzcjy
Copy link
Contributor Author

fzyzcjy commented Nov 17, 2022

Thanks :) I will modify and update it soon (no time now though)

@pdblasi-google
Copy link
Contributor

Followup on moving the invariant verifications into an addTearDown (came to me at about 3AM last night...).

I think if we move the invariant verifications into an addTearDown, we may also need to move the storing of those variables (for checking the end state) that get checked into a setUp call. I think as it stands right now, if someone were to use setUp to change an invariant, it'll have a couple problems:

a) It won't validate that the invariant is reset after the test, since it's actually set before the test
b) If (after this issue is fixed) the invariant is reset via an addTearDown or tearDown, then the verifications will fail because they'll have the changed value saved to check against, since it was changed before the test.

@fzyzcjy
Copy link
Contributor Author

fzyzcjy commented Nov 17, 2022

Good point! I will check that later.

@fzyzcjy
Copy link
Contributor Author

fzyzcjy commented Nov 23, 2022

Well, tearDown does not seem to work. I guess it is because, our addTearDown(verifyInvariants) are called before this user-added tearDown. Thus, even if user resets value in this tearDown, our verifications run before that so is not aware of it.

However, IMHO this PR is still useful, because even if tearDown is not supported, it adds support for addTearDown, which is very frequently used.


tests:

    group('tearDown does not work yet', () {
      tearDown(() {
        timeDilation = 1;
      });

      testWidgets('main test inside group', (WidgetTester tester) async {
        timeDilation = 2;
      });
    });

yields

package:flutter/src/scheduler/binding.dart 662:9  SchedulerBinding.debugAssertNoTimeDilation.<fn>
package:flutter/src/scheduler/binding.dart 665:6  SchedulerBinding.debugAssertNoTimeDilation
package:flutter_test/src/binding.dart 971:12      TestWidgetsFlutterBinding._verifyInvariants
package:flutter_test/src/binding.dart 1436:11     AutomatedTestWidgetsFlutterBinding._verifyInvariants
package:flutter_test/src/binding.dart 950:9       TestWidgetsFlutterBinding._runTestBody.<fn>
===== asynchronous gap ===========================
dart:async                                        _CustomZone.registerUnaryCallback
package:flutter_test/src/binding.dart 941:9       TestWidgetsFlutterBinding._runTestBody.<fn>

The timeDilation was changed and not reset by the test.

This reverts commit d3c466d.
@fzyzcjy
Copy link
Contributor Author

fzyzcjy commented Nov 23, 2022

Hmm CI fails. I will firstly revert now

@pdblasi-google
Copy link
Contributor

@fzyzcjy Apologies for the delay in followup.

It looks like the commit that failed CI only included the change to move most of the checks into the teardown, not moving the pre-test checks that grab the current values into a setup. As I mentioned in another comment, both changes would be needed to support the teardown for those additional cases since they compare against values that are (currently) set in the actual test.

Are you willing to keep pursuing those other validations being moved to the teardown as well, or should I file an issue for the rest and followup with that idea at a later date?

@fzyzcjy
Copy link
Contributor Author

fzyzcjy commented Feb 10, 2023

@pdblasi-google Hi thanks for the reply. I am quite busy recently, so it would be great to firstly merge a minimal PR and then do another PR later :)

@pdblasi-google
Copy link
Contributor

@fzyzcjy Sounds good. I'll re-review here shortly with the intent to only support the current sub-set you have here and write up an issue for the rest of the variant checks.

Copy link
Contributor

@pdblasi-google pdblasi-google left a comment

Choose a reason for hiding this comment

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

LGTM

packages/flutter_test/lib/src/binding.dart Show resolved Hide resolved
@@ -959,6 +968,10 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
late bool _beforeTestCheckIntrinsicSizes;

void _verifyInvariants() {
// subclasses overrides this
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: This comment threw me off when I read it. I read this as "subclasses are intended to override this method" not as "existing subclasses in this library already override this method", which had me confused as to why we were intending users to override a private method. More explicit verbiage as to why we're keeping this method would be appreciated.

Copy link
Member

Choose a reason for hiding this comment

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

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

LGTM after comment is updated.

@@ -959,6 +968,10 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
late bool _beforeTestCheckIntrinsicSizes;

void _verifyInvariants() {
// subclasses overrides this
Copy link
Member

Choose a reason for hiding this comment

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

+1

@fzyzcjy
Copy link
Contributor Author

fzyzcjy commented Feb 14, 2023

Hmm I already merge from latest master but CI is still unhappy...

image

@pdblasi-google
Copy link
Contributor

I think around that time there we hit a rate limit for the service that does the .ci.yaml check. I remember seeing something about it in the discord. Should be good to go now, I'll add the autosubmit tag and you should be good!

@pdblasi-google pdblasi-google added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 14, 2023
@auto-submit auto-submit bot merged commit 577ad2e into flutter:master Feb 15, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Feb 15, 2023
* 7fb8497b5 Roll Plugins from 02571ec to f3bc6f1 (2 revisions) (flutter/flutter#120601)

* 7c2d5b9c2 60c8532d6 Roll Fuchsia Mac SDK from NZAnfCkpbswhYplty... to 6hbPQq6ED0PkuQiKM... (flutter/engine#39587) (flutter/flutter#120602)

* 1f268f1d6 fb8840578 Roll Dart SDK from 1caf3a9ad101 to f80c5db8736a (1 revision) (flutter/engine#39588) (flutter/flutter#120606)

* 957494d9f Marks Linux_android flavors_test to be unflaky (flutter/flutter#120299)

* 0792c2795 Roll Flutter Engine from fb8840578156 to df0ffe42b33e (2 revisions) (flutter/flutter#120607)

* 7bacc25ee Remove accentColorBrightness usage (flutter/flutter#120577)

* 98576cef5 Avoid null terminating characters in strings from Utf8FromUtf16() (flutter/flutter#109729)

* 00adf9a33 roll packages (flutter/flutter#120609)

* 2df140f40 Remove references to Observatory (flutter/flutter#118577)

* a819d6156 Remove `prefer_equal_for_default_values` lint rule (flutter/flutter#120533)

* 73afc7ba3 Roll Flutter Engine from df0ffe42b33e to 97dcf3e6201e (4 revisions) (flutter/flutter#120617)

* f858302a6 Remove `brightness` from `AppBar`/`SliverAppBar`/`AppBarTheme`/`AppBarTheme.copyWith` (flutter/flutter#120575)

* 95fd821ab Force `Mac build_tests` to run on x64 bots (flutter/flutter#120620)

* ed35c80d2 d28cbf402 [Impeller] Return entity from filters instead of a snapshot (flutter/engine#39560) (flutter/flutter#120625)

* 778b3fa32 support updating dragDecices at runtime (flutter/flutter#120336)

* ddebe833b Added integration test for wide gamut support. (flutter/flutter#119657)

* becb6bd00 Fix message type inconsistency between locales (flutter/flutter#120129)

* f4495f5d3 Roll Flutter Engine from d28cbf402904 to 31a4648cbe99 (2 revisions) (flutter/flutter#120630)

* 402caec2e Fix `ListTile`'s default `iconColor` token used & update examples (flutter/flutter#120444)

* 865422da2 Force `Mac tool_integration_tests` to run on x64 bots (flutter/flutter#120634)

* 07c548c69 Apply BindingBase.checkInstance to TestDefaultBinaryMessengerBinding (flutter/flutter#116937)

* b08cc8be7 Roll Flutter Engine from 31a4648cbe99 to c4f51bc78644 (7 revisions) (flutter/flutter#120656)

* 6a94f25a9 Roll Flutter Engine from c4f51bc78644 to 17ab09d382e3 (5 revisions) (flutter/flutter#120664)

* b0edf5829 Roll Flutter Engine from 17ab09d382e3 to cbb7fc020b00 (2 revisions) (flutter/flutter#120673)

* 17b4c70ff [M3] Add customizable overflow property to Snackbar's action (flutter/flutter#120394)

* b35e4a54f Roll Plugins from f3bc6f1 to 9c312d4 (2 revisions) (flutter/flutter#120694)

* 9fd34048f f4fcb911b Roll Skia from bb7b22f3f444 to 8de7f68a3661 (1 revision) (flutter/engine#39619) (flutter/flutter#120699)

* b9b4d3e43 roll packages (flutter/flutter#120628)

* ed5bd1779 Fix tree by updating dependencies (flutter/flutter#120707)

* 480c54c37 Increase Linux docs_publish timeout (flutter/flutter#120718)

* c102bf467 [integration_test] Fix link to integration test for web section in `README.md` (flutter/flutter#103422)

* 577ad2ee8 Fix error when resetting configurations in tear down phase (flutter/flutter#114468)

* 2cfca820a Force Mac plugin_test to run on x64 bots (flutter/flutter#120714)

* fd2fd94e3 d86089252 Roll Fuchsia Mac SDK from OeUljRQOmJwgDhNOo... to EFcCpAxOuQllDqP0F... (flutter/engine#39621) (flutter/flutter#120702)

* 9d94a51b6 Move linux-x64-flutter-gtk.zip to linux-x64-debug location. (flutter/flutter#120658)

* d29668ddb Improve network resources doctor check (flutter/flutter#120417)

* 378668db4 added MaterialStateColor support to TabBarTheme.labelColor (flutter/flutter#109541)

* ba46cb8d5 Remove deprecated AppBar.color & AppBar.backwardsCompatibility (flutter/flutter#120618)

* 5a3957f3b Revert "Fix error when resetting configurations in tear down phase" (flutter/flutter#120739)

* fd01812f6 Add temporary default case to support new PointerSignalKind (flutter/flutter#120731)

* 4b8ad1b00 Temporarily disable info-based analyzer unit tests. (flutter/flutter#120753)

* 911b13784 Roll Flutter Engine from d860892528ff to 44e36c9c0d73 (20 revisions) (flutter/flutter#120761)

* 4ae5252f8 Fix license page crash (flutter/flutter#120728)

* 31c73fcfe Roll Flutter Engine from 44e36c9c0d73 to bf7d51586704 (2 revisions) (flutter/flutter#120772)

* 624445a45 Roll Flutter Engine from bf7d51586704 to ec70b5aa96be (2 revisions) (flutter/flutter#120781)

* df41e58f6 1328c4bc6 Roll Dart SDK from 0456c4011cb3 to c022d475e9d8 (1 revision) (flutter/engine#39646) (flutter/flutter#120784)
auto-submit bot pushed a commit to flutter/plugins that referenced this pull request Feb 15, 2023
* 001c495 Roll Flutter Engine from 9a40a384997d to e1d0032029e4 (6 revisions) (flutter/flutter#120414)

* 96823590e post submit only (flutter/flutter#120411)

* 5dbd28101 Use String.codeUnitAt instead of String.codeUnits[] in ParagraphBoundary (flutter/flutter#120234)

* f05a555bc Fix lerping for `NavigationRailThemeData` icon themes (flutter/flutter#120066)

* b0d04ea49 add9e11ed Fix position of BackdropFilter above PlatformView (flutter/engine#39244) (flutter/flutter#120415)

* 858f94cfa Roll Plugins from 73986f4 to 02571ec (3 revisions) (flutter/flutter#120443)

* 298c874ea Fix classes that shouldn't be extended/instantiated/mixedin (flutter/flutter#120409)

* 25c2c22d2 Delete Chrome temp cache after closing (flutter/flutter#119062)

* b2e37c659 [conductor] Tag engine versions (flutter/flutter#120419)

* 780c9a8de Remove deprecated SystemChrome.setEnabledSystemUIOverlays (flutter/flutter#119576)

* 52ab29936 Roll Flutter Engine from add9e11edb66 to 4104eb5cbc40 (14 revisions) (flutter/flutter#120470)

* 65fd924d8 [conductor] Remove CiYaml model (flutter/flutter#120458)

* d5dbcb708 Revert "Revert "[web] Move JS content to its own `.js` files (#117691)" (#120275)" (flutter/flutter#120363)

* 2f9abd20f Roll Flutter Engine from 4104eb5cbc40 to 6660300ea34f (6 revisions) (flutter/flutter#120487)

* d63c54c9c roll packages (flutter/flutter#120493)

* 941578ea9 Roll Flutter Engine from 6660300ea34f to 5e3ff1e5c9b3 (4 revisions) (flutter/flutter#120495)

* b3613c4cf f737dc868 [macOS] Add XCode marks for TextInputPlugin (flutter/engine#39550) (flutter/flutter#120501)

* 4ab2ffd58 Roll Flutter Engine from f737dc868a3e to 3ac3338489d2 (2 revisions) (flutter/flutter#120505)

* 859d57b3c 8baee2164 Roll Skia from 5230650dc096 to 70a3a194ec98 (2 revisions) (flutter/engine#39554) (flutter/flutter#120507)

* e42ab1cb0 c3dc68e0e Roll Skia from 70a3a194ec98 to 6c3097e6f833 (1 revision) (flutter/engine#39555) (flutter/flutter#120508)

* 61e059f44 Roll Flutter Engine from c3dc68e0e263 to 363355af5158 (2 revisions) (flutter/flutter#120511)

* d27de1de0 5efb42971 Roll Fuchsia Linux SDK from 482Njb1v72P7fNyj4... to MVMTNxWJaWdwPWstz... (flutter/engine#39559) (flutter/flutter#120512)

* bbf8446d9 761891200 Roll Dart SDK from 1d26a1d57edf to b1836aacc08a (1 revision) (flutter/engine#39561) (flutter/flutter#120513)

* 0346f4b18 d8e01097e Roll Fuchsia Mac SDK from 6nMZjuYXTcnD_VZQI... to FxFPRn_9rSWWAWFw0... (flutter/engine#39562) (flutter/flutter#120519)

* 0db47bdd0 Revert "Fix BottomAppBar & BottomSheet M3 shadow (#119819)" (flutter/flutter#120492)

* f04600bfb Roll Flutter Engine from d8e01097e66b to 2cba062f9f4c (2 revisions) (flutter/flutter#120538)

* 274f6cb2d Roll Flutter Engine from 2cba062f9f4c to 05d81c0f2ebe (2 revisions) (flutter/flutter#120547)

* d6ff0f2af fe56a45b4 Roll Dart SDK from c4255cea566a to 1caf3a9ad101 (1 revision) (flutter/engine#39571) (flutter/flutter#120552)

* 7295d4fe9 9a19d7eea Roll Fuchsia Linux SDK from arbaBzyUE2ok1bGl5... to 8fdyKaKQqTPpjcp-L... (flutter/engine#39572) (flutter/flutter#120554)

* 6d68eb7b8 0aa4fcbd2 Roll Skia from ec87ec6fd34f to 615965d545f4 (1 revision) (flutter/engine#39573) (flutter/flutter#120558)

* 527977b6a b7e80ad6e Roll Fuchsia Mac SDK from y35kWL0rP5Nd06lTg... to KpTOXssqVhPv2OBZi... (flutter/engine#39574) (flutter/flutter#120559)

* 238b0dbc0 Roll Flutter Engine from b7e80ad6ef51 to 1ff345ce5f63 (2 revisions) (flutter/flutter#120574)

* 3e659cf71 1eef041d4 [Impeller] Source the pipeline color attachment pixel format from RenderPass textures (flutter/engine#39556) (flutter/flutter#120576)

* 53fe8a3f9 4107a7b71 Roll Skia from 615965d545f4 to c6f1de2239fb (1 revision) (flutter/engine#39581) (flutter/flutter#120580)

* b0c24e8d3 fix a Slider theme update bug (flutter/flutter#120432)

* b33c76f01 1695b7bbc Bump github/codeql-action from 2.1.39 to 2.2.4 (flutter/engine#39584) (flutter/flutter#120588)

* ce8efb439 ede2a0a3c Roll Skia from c6f1de2239fb to d85501fa487d (1 revision) (flutter/engine#39585) (flutter/flutter#120593)

* 7fb8497b5 Roll Plugins from 02571ec to f3bc6f1 (2 revisions) (flutter/flutter#120601)

* 7c2d5b9c2 60c8532d6 Roll Fuchsia Mac SDK from NZAnfCkpbswhYplty... to 6hbPQq6ED0PkuQiKM... (flutter/engine#39587) (flutter/flutter#120602)

* 1f268f1d6 fb8840578 Roll Dart SDK from 1caf3a9ad101 to f80c5db8736a (1 revision) (flutter/engine#39588) (flutter/flutter#120606)

* 957494d9f Marks Linux_android flavors_test to be unflaky (flutter/flutter#120299)

* 0792c2795 Roll Flutter Engine from fb8840578156 to df0ffe42b33e (2 revisions) (flutter/flutter#120607)

* 7bacc25ee Remove accentColorBrightness usage (flutter/flutter#120577)

* 98576cef5 Avoid null terminating characters in strings from Utf8FromUtf16() (flutter/flutter#109729)

* 00adf9a33 roll packages (flutter/flutter#120609)

* 2df140f40 Remove references to Observatory (flutter/flutter#118577)

* a819d6156 Remove `prefer_equal_for_default_values` lint rule (flutter/flutter#120533)

* 73afc7ba3 Roll Flutter Engine from df0ffe42b33e to 97dcf3e6201e (4 revisions) (flutter/flutter#120617)

* f858302a6 Remove `brightness` from `AppBar`/`SliverAppBar`/`AppBarTheme`/`AppBarTheme.copyWith` (flutter/flutter#120575)

* 95fd821ab Force `Mac build_tests` to run on x64 bots (flutter/flutter#120620)

* ed35c80d2 d28cbf402 [Impeller] Return entity from filters instead of a snapshot (flutter/engine#39560) (flutter/flutter#120625)

* 778b3fa32 support updating dragDecices at runtime (flutter/flutter#120336)

* ddebe833b Added integration test for wide gamut support. (flutter/flutter#119657)

* becb6bd00 Fix message type inconsistency between locales (flutter/flutter#120129)

* f4495f5d3 Roll Flutter Engine from d28cbf402904 to 31a4648cbe99 (2 revisions) (flutter/flutter#120630)

* 402caec2e Fix `ListTile`'s default `iconColor` token used & update examples (flutter/flutter#120444)

* 865422da2 Force `Mac tool_integration_tests` to run on x64 bots (flutter/flutter#120634)

* 07c548c69 Apply BindingBase.checkInstance to TestDefaultBinaryMessengerBinding (flutter/flutter#116937)

* b08cc8be7 Roll Flutter Engine from 31a4648cbe99 to c4f51bc78644 (7 revisions) (flutter/flutter#120656)

* 6a94f25a9 Roll Flutter Engine from c4f51bc78644 to 17ab09d382e3 (5 revisions) (flutter/flutter#120664)

* b0edf5829 Roll Flutter Engine from 17ab09d382e3 to cbb7fc020b00 (2 revisions) (flutter/flutter#120673)

* 17b4c70ff [M3] Add customizable overflow property to Snackbar's action (flutter/flutter#120394)

* b35e4a54f Roll Plugins from f3bc6f1 to 9c312d4 (2 revisions) (flutter/flutter#120694)

* 9fd34048f f4fcb911b Roll Skia from bb7b22f3f444 to 8de7f68a3661 (1 revision) (flutter/engine#39619) (flutter/flutter#120699)

* b9b4d3e43 roll packages (flutter/flutter#120628)

* ed5bd1779 Fix tree by updating dependencies (flutter/flutter#120707)

* 480c54c37 Increase Linux docs_publish timeout (flutter/flutter#120718)

* c102bf467 [integration_test] Fix link to integration test for web section in `README.md` (flutter/flutter#103422)

* 577ad2ee8 Fix error when resetting configurations in tear down phase (flutter/flutter#114468)

* 2cfca820a Force Mac plugin_test to run on x64 bots (flutter/flutter#120714)

* fd2fd94e3 d86089252 Roll Fuchsia Mac SDK from OeUljRQOmJwgDhNOo... to EFcCpAxOuQllDqP0F... (flutter/engine#39621) (flutter/flutter#120702)

* 9d94a51b6 Move linux-x64-flutter-gtk.zip to linux-x64-debug location. (flutter/flutter#120658)

* d29668ddb Improve network resources doctor check (flutter/flutter#120417)

* 378668db4 added MaterialStateColor support to TabBarTheme.labelColor (flutter/flutter#109541)

* ba46cb8d5 Remove deprecated AppBar.color & AppBar.backwardsCompatibility (flutter/flutter#120618)

* 5a3957f3b Revert "Fix error when resetting configurations in tear down phase" (flutter/flutter#120739)

* fd01812f6 Add temporary default case to support new PointerSignalKind (flutter/flutter#120731)

* 4b8ad1b00 Temporarily disable info-based analyzer unit tests. (flutter/flutter#120753)

* 911b13784 Roll Flutter Engine from d860892528ff to 44e36c9c0d73 (20 revisions) (flutter/flutter#120761)

* 4ae5252f8 Fix license page crash (flutter/flutter#120728)

* 31c73fcfe Roll Flutter Engine from 44e36c9c0d73 to bf7d51586704 (2 revisions) (flutter/flutter#120772)

* 624445a45 Roll Flutter Engine from bf7d51586704 to ec70b5aa96be (2 revisions) (flutter/flutter#120781)

* df41e58f6 1328c4bc6 Roll Dart SDK from 0456c4011cb3 to c022d475e9d8 (1 revision) (flutter/engine#39646) (flutter/flutter#120784)
@gnprice
Copy link
Member

gnprice commented Mar 21, 2023

Is there an issue that tracks the problem this PR was aiming to solve? It'd be great to have it fixed, and I think an issue would be helpful on the way to that.

I see #121917 is related, but I think it's somewhat different: that would add a new function addTearDownWidgets(WidgetTesterCallback callback) for teardowns that need access to WidgetTester functionality, whereas this is about making the existing function addTearDown interact properly with the invariant checks.

If there isn't an issue, I'd be glad to file one — I'd basically copy-paste most of this PR description and make small edits (and of course credit where it came from.)

@pdblasi-google
Copy link
Contributor

pdblasi-google commented Mar 21, 2023

@gnprice

The "Modifications" section of that issue should enable setup and addTearDown to work appropriately. The root problem here is that testWidgets is doing a lot of not-testing in its test call, which leads to things not being set up early enough to use the test library's setup.

When just the actual test is run within the test call, this problem should go away.

@gnprice
Copy link
Member

gnprice commented Mar 22, 2023

Ah excellent, good to know.

I think this PR has a nice clear problem statement for a particular problem which I'd like to be able to point to an issue to refer to, so I'll go ahead and file one. Then #121917 is a specific proposal that would solve this problem as well as accomplishing some other useful things, and I'll mention that relationship in the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: tests "flutter test", flutter_test, or one of our tests autosubmit Merge PR when tree becomes green via auto submit App framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants