-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[video_player] Activate leak testing #8379
base: main
Are you sure you want to change the base?
[video_player] Activate leak testing #8379
Conversation
Since I modified only the tests, I think this PR is eligible for the tags |
cc @polina-c |
@@ -698,6 +723,7 @@ void main() { | |||
expect(controller.value.isPlaying, isTrue); | |||
|
|||
await controller.pause(); | |||
await tester.runAsync(controller.dispose); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For those ones, I didn't manage to make the test pass without using runAsync
.
If I use
addTearDown(() {
controller.dispose();
});
or
// end of test
unawaited(controller.dispose());
// a lot of
tester.pump();
tester.pump();
it doesn't fix the memory leak.
If I use
addTearDown(controller.dispose());
or
// end of test
await controller.dispose();
the test hangs and times out.
Do you have an idea on how to do it better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks smelly for me that dispose
is async. But, it is test only class, so it is ok.
And thus runAsync
makes perfect sense.
b1e7de6
to
19261d2
Compare
Any thoughts on this PR @tarrinneal ? |
The package manipulates disposable objects. This PR activates leak testing to make sure disposable objects are correctly disposed.
It also fixes the memory leak warnings from the tests
See the documentation: https://github.com/dart-lang/leak_tracker/blob/main/doc%2Fleak_tracking%2FDETECT.md
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style, or this PR is exempt from CHANGELOG changes.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.