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

Add Awaits extensions similar to Runs to await suspend functions until cancelled #927

Merged
merged 6 commits into from Oct 5, 2022

Conversation

SimonMarquis
Copy link
Contributor

And adding kotlinCoroutinesTest dependency for testing purposes.

Examples:

coJustAwait { mock.coOp() }
coEvery { mock.coOp() } just awaits
coEvery { mock.coOp() } answers { 1 } andThenJust awaits

See discussion #924

SimonMarquis and others added 2 commits September 25, 2022 23:15
…until cancelled

And adding kotlinCoroutinesTest dependency for testing purposes.
@SimonMarquis
Copy link
Contributor Author

SimonMarquis commented Oct 2, 2022

👋 Hi, not sure why this error happens.
It works fine on my local env, could this be a caching issue?

Failures are all using javaToolchainTestVersion=19

FAILURE: Build failed with an exception.

* Where:
Initialization script '/home/runner/.gradle/init.d/build-result-capture.init.gradle' line: 76

* What went wrong:
Could not open dsl generic class cache for script '/home/runner/.gradle/init.d/build-result-capture-service.plugin.groovy' (/home/runner/.gradle/caches/7.5.1/scripts/9y1w1goaggjti8kw09okbawrx).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 63

https://github.com/mockk/mockk/actions/runs/3160090370/jobs/5159103278#step:5:20

@SimonMarquis
Copy link
Contributor Author

SimonMarquis commented Oct 2, 2022

Latest Gradle 7.5.1 does not seem to be compatible with the newly released Java 19.

Java 19 and later versions are not yet supported.
https://docs.gradle.org/current/userguide/compatibility.html

CI did not run completely (was cancelled) on the commit upgrading Java version: 985c6fe

What should we do?

  • Revert to Java 18 until Gradle officially supports it?
  • Use an nightly Gradle version (or 7.6-rc1) and see if it works?
  • Ignore those errors until Gradle officially supports Java 19?

@Raibaz
Copy link
Collaborator

Raibaz commented Oct 4, 2022

I'd remove support for java 19 until gradle supports it.

I think you can do it in this PR.

Thanks for looking into it!

@Raibaz
Copy link
Collaborator

Raibaz commented Oct 5, 2022

Code LGTM, can you please just add an example usage of just Awaits and coJustAwait in the documentation in README.md?

@SimonMarquis
Copy link
Contributor Author

@Raibaz tell me if the coJustAwait example is good enough.
Also, I've flagged these new APIs as (available since v1.13.3) but I'll let you decide for the new version name.

@Raibaz
Copy link
Collaborator

Raibaz commented Oct 5, 2022

That's perfect, thanks a lot!

@Raibaz Raibaz merged commit ddf677e into mockk:master Oct 5, 2022
@SimonMarquis SimonMarquis deleted the coJustAwait branch October 5, 2022 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants