Skip to content

[flutter_tools] fix tests that depend on correct cache existance - #60241

Merged
jonahwilliams merged 1 commit into
flutter:masterfrom
jonahwilliams:fix_devices_test_123
Jun 24, 2020
Merged

jonahwilliams merged 1 commit into
flutter:masterfrom
jonahwilliams:fix_devices_test_123

Conversation

@jonahwilliams

@jonahwilliams jonahwilliams commented Jun 24, 2020 •

Copy link
Copy Markdown
Contributor

Description

These tests will hit the real Cache, failing if the flutter root has been modified

@fluttergithubbot fluttergithubbot added the tool Affects the "flutter" command-line tool. See also t: labels. label Jun 24, 2020

setUp(() {
cache = MockCache();
when(cache.dyLdLibEntry).thenReturn(const MapEntry<String, String>('foo', 'bar'));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Device discovery created by instantiating DeviceDiscoverers looks up this entry from the cache, will fail if the path does not exist.


setUp(() {
cache = MockCache();
when(cache.dyLdLibEntry).thenReturn(const MapEntry<String, String>('foo', 'bar'));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same here

trackWidgetCreation: false,
treeShakeIcons: false,
),
generator: MockResidentCompiler(),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If the generator is not provided, one is created but that looks up the dartSdk path from the cache.

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.

🤦

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.

I thought it was hard to write tools tests, but turns out I had no idea...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the nice thing is ... there are no issues with the tests using testWithoutContext, so at least we are on the right path 👍

@christopherfujino christopherfujino 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.

LGTM

@flutter-github-sync

Copy link
Copy Markdown

Started Google testing for this PR

@jonahwilliams
jonahwilliams merged commit 5cfcae0 into flutter:master Jun 24, 2020
@jonahwilliams
jonahwilliams deleted the fix_devices_test_123 branch June 24, 2020 23:50
mingwandroid pushed a commit to mingwandroid/flutter that referenced this pull request Sep 6, 2020
…tter#60241)

These tests will hit the real Cache, failing if the flutter root has been modified
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jul 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants