Skip to content

Roll mockito to 5.4.0 #3544

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

Merged
merged 15 commits into from
Mar 30, 2023
Merged

Roll mockito to 5.4.0 #3544

merged 15 commits into from
Mar 30, 2023

Conversation

natebosch
Copy link
Contributor

@natebosch natebosch commented Mar 24, 2023

The pinned version of mockito is incompatible with the latest released version of test_api, and therefore test. With flutter package pinning, the release of the flutter SDK that updates to the next version of test_api will break the version solve with these packages. Use the 5.4.0 version of mockito which is forwards compatible.

This is required to unblock flutter/flutter#123350, flutter/flutter#123603

The pinned version of `mockito` is incompatible with the latest released
version of `test_api`, and therefore `test`. With flutter package
pinning, the release of the flutter SDK that updates to the next version
of `test_api` will break the version solve with these packages. Using a
constraint that allows a range of versions of `mockito` should allow a
valid version solve.
@natebosch
Copy link
Contributor Author

doesn't seem to update the mock files

I found some extends Mock and then stopped looking - I should have checked more directories. I've regenerated the mocks in the packages that were using codegen.

@ditman
Copy link
Member

ditman commented Mar 28, 2023

Actually I tried to update some of the mocks that were generated with 5.3.2 on this branch, and they stay the same, so I guess the examples are fine too!

dit@dit:/work/flutter/packages/packages/google_maps_flutter/google_maps_flutter_web/example$ cat integration_test/google_maps_controller_test.mocks.dart 
// Mocks generated by Mockito 5.3.2 from annotations
// in google_maps_flutter_web_integration_tests/integration_test/google_maps_controller_test.dart.
// Do not manually edit this file.

@natebosch
Copy link
Contributor Author

and they stay the same,

Hmm, I would expect at least the // Mocks generated by Mockito 5.3.2 to change...

In a couple packages that are generating in a directory named
`integration_test/` instead of `test/`, add a `generate_for` argument to
run mockito against those tests.

Remove a stale unused mock file. If a `build_runner build` had been run
following the removal of the source file, with an asset graph from the
build that included the file, it would have been removed. If the source
file is removed and no builds are ever run with the asset graph from the
build including it, the output will be ignored by the build system.
@natebosch
Copy link
Contributor Author

I added some generate_for config and regenerated mocks in packages using a directory named integraion_test/ instead of test/. I also removed a stale mock file that was no longer used at all.

Mockito 5.4.0 restricts mocks from sharing a name with a class, the
import prefix does not work around the mockito check.
@natebosch
Copy link
Contributor Author

natebosch commented Mar 29, 2023

https://cirrus-ci.com/task/5467466374053888

The following packages had errors:
  camera_android_camerax
See above for full details.

Searching the page for camera_android_camerax does not find any other occurrences...
Is there some other way to see the logs for what failed?
flutter test passes for me in packages/camera/camera_android_camerax/

Edit: I found the link to the full log: https://api.cirrus-ci.com/v1/task/5467466374053888/logs/unit_test.log

The newer SDK switches the argument in the original definition to a
typedef, but the older SDK doesn't have that typedef.
The newer SDK switches the argument in the original definition to a
typedef, but the older SDK doesn't have that typedef.
@natebosch natebosch added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 29, 2023
@ditman
Copy link
Member

ditman commented Mar 30, 2023

submit-queue is just the check that stops merges to main if there's currently a broken test in the top of the repo. This PR looks ready to land.

Thanks for digging in the unchanged mocks! @natebosch

Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

Final version LGTM as well. Thanks!

@auto-submit auto-submit bot merged commit 199fc68 into flutter:main Mar 30, 2023
@natebosch natebosch deleted the mockito-range branch March 30, 2023 14:30
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 30, 2023
auto-submit bot pushed a commit that referenced this pull request May 26, 2023
Part of flutter/flutter#127226

Follow up to #3544. Version 5.4.0 from that PR is not new enough, see

```
Because mockito >=5.4.0 <5.4.1 depends on test_api >=0.2.1 <0.6.0 and every version of flutter_test from sdk depends on test_api 0.6.0, mockito >=5.4.0 <5.4.1 is incompatible with flutter_test from sdk.
So, because quick_actions_platform_interface depends on both flutter_test from sdk and mockito 5.4.0, version solving failed.
```

https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8780090492483790881/+/u/run_test.dart_for_flutter_plugins_shard_and_subshard_analyze/test_stdout
nploi pushed a commit to nploi/packages that referenced this pull request Jul 16, 2023
nksteven pushed a commit to nksteven/ez_image_picker that referenced this pull request Aug 29, 2023
Part of flutter/flutter#127226

Follow up to flutter/packages#3544. Version 5.4.0 from that PR is not new enough, see

```
Because mockito >=5.4.0 <5.4.1 depends on test_api >=0.2.1 <0.6.0 and every version of flutter_test from sdk depends on test_api 0.6.0, mockito >=5.4.0 <5.4.1 is incompatible with flutter_test from sdk.
So, because quick_actions_platform_interface depends on both flutter_test from sdk and mockito 5.4.0, version solving failed.
```

https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8780090492483790881/+/u/run_test.dart_for_flutter_plugins_shard_and_subshard_analyze/test_stdout
nksteven pushed a commit to nksteven/ez_image_picker_ios that referenced this pull request Aug 29, 2023
Part of flutter/flutter#127226

Follow up to flutter/packages#3544. Version 5.4.0 from that PR is not new enough, see

```
Because mockito >=5.4.0 <5.4.1 depends on test_api >=0.2.1 <0.6.0 and every version of flutter_test from sdk depends on test_api 0.6.0, mockito >=5.4.0 <5.4.1 is incompatible with flutter_test from sdk.
So, because quick_actions_platform_interface depends on both flutter_test from sdk and mockito 5.4.0, version solving failed.
```

https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8780090492483790881/+/u/run_test.dart_for_flutter_plugins_shard_and_subshard_analyze/test_stdout
tony-hristov pushed a commit to tony-hristov/webview_flutter that referenced this pull request Sep 12, 2023
Part of flutter/flutter#127226

Follow up to flutter/packages#3544. Version 5.4.0 from that PR is not new enough, see

```
Because mockito >=5.4.0 <5.4.1 depends on test_api >=0.2.1 <0.6.0 and every version of flutter_test from sdk depends on test_api 0.6.0, mockito >=5.4.0 <5.4.1 is incompatible with flutter_test from sdk.
So, because quick_actions_platform_interface depends on both flutter_test from sdk and mockito 5.4.0, version solving failed.
```

https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8780090492483790881/+/u/run_test.dart_for_flutter_plugins_shard_and_subshard_analyze/test_stdout
bill-skdnd pushed a commit to skdnd-metaspace/webview_flutter_wkwebview that referenced this pull request Aug 2, 2024
Part of flutter/flutter#127226

Follow up to flutter/packages#3544. Version 5.4.0 from that PR is not new enough, see

```
Because mockito >=5.4.0 <5.4.1 depends on test_api >=0.2.1 <0.6.0 and every version of flutter_test from sdk depends on test_api 0.6.0, mockito >=5.4.0 <5.4.1 is incompatible with flutter_test from sdk.
So, because quick_actions_platform_interface depends on both flutter_test from sdk and mockito 5.4.0, version solving failed.
```

https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8780090492483790881/+/u/run_test.dart_for_flutter_plugins_shard_and_subshard_analyze/test_stdout
dko5ki23t pushed a commit to dko5ki23t/google_maps_flutter_improved that referenced this pull request May 24, 2025
Part of flutter/flutter#127226

Follow up to flutter/packages#3544. Version 5.4.0 from that PR is not new enough, see

```
Because mockito >=5.4.0 <5.4.1 depends on test_api >=0.2.1 <0.6.0 and every version of flutter_test from sdk depends on test_api 0.6.0, mockito >=5.4.0 <5.4.1 is incompatible with flutter_test from sdk.
So, because quick_actions_platform_interface depends on both flutter_test from sdk and mockito 5.4.0, version solving failed.
```

https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8780090492483790881/+/u/run_test.dart_for_flutter_plugins_shard_and_subshard_analyze/test_stdout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants