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

Remove TestCoroutineContext.kt completely #3291

Merged
merged 2 commits into from May 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 0 additions & 4 deletions kotlinx-coroutines-core/README.md
Expand Up @@ -83,10 +83,6 @@ Select expression to perform multiple suspending operations simultaneously until

Low-level primitives for finer-grained control of coroutines.

# Package kotlinx.coroutines.test

Obsolete and deprecated module to test coroutines. Replaced with `kotlinx-coroutines-test` module.

<!--- MODULE kotlinx-coroutines-core -->
<!--- INDEX kotlinx.coroutines -->

Expand Down
33 changes: 0 additions & 33 deletions kotlinx-coroutines-core/api/kotlinx-coroutines-core.api
Expand Up @@ -1299,36 +1299,3 @@ public final class kotlinx/coroutines/sync/SemaphoreKt {
public static final fun withPermit (Lkotlinx/coroutines/sync/Semaphore;Lkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}

public final class kotlinx/coroutines/test/TestCoroutineContext : kotlin/coroutines/CoroutineContext {
public fun <init> ()V
public fun <init> (Ljava/lang/String;)V
public synthetic fun <init> (Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun advanceTimeBy (JLjava/util/concurrent/TimeUnit;)J
public static synthetic fun advanceTimeBy$default (Lkotlinx/coroutines/test/TestCoroutineContext;JLjava/util/concurrent/TimeUnit;ILjava/lang/Object;)J
public final fun advanceTimeTo (JLjava/util/concurrent/TimeUnit;)V
public static synthetic fun advanceTimeTo$default (Lkotlinx/coroutines/test/TestCoroutineContext;JLjava/util/concurrent/TimeUnit;ILjava/lang/Object;)V
public final fun assertAllUnhandledExceptions (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V
public static synthetic fun assertAllUnhandledExceptions$default (Lkotlinx/coroutines/test/TestCoroutineContext;Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
public final fun assertAnyUnhandledException (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V
public static synthetic fun assertAnyUnhandledException$default (Lkotlinx/coroutines/test/TestCoroutineContext;Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
public final fun assertExceptions (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V
public static synthetic fun assertExceptions$default (Lkotlinx/coroutines/test/TestCoroutineContext;Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
public final fun assertUnhandledException (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V
public static synthetic fun assertUnhandledException$default (Lkotlinx/coroutines/test/TestCoroutineContext;Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
public final fun cancelAllActions ()V
public fun fold (Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object;
public fun get (Lkotlin/coroutines/CoroutineContext$Key;)Lkotlin/coroutines/CoroutineContext$Element;
public final fun getExceptions ()Ljava/util/List;
public fun minusKey (Lkotlin/coroutines/CoroutineContext$Key;)Lkotlin/coroutines/CoroutineContext;
public final fun now (Ljava/util/concurrent/TimeUnit;)J
public static synthetic fun now$default (Lkotlinx/coroutines/test/TestCoroutineContext;Ljava/util/concurrent/TimeUnit;ILjava/lang/Object;)J
public fun plus (Lkotlin/coroutines/CoroutineContext;)Lkotlin/coroutines/CoroutineContext;
public fun toString ()Ljava/lang/String;
public final fun triggerActions ()V
}

public final class kotlinx/coroutines/test/TestCoroutineContextKt {
public static final fun withTestContext (Lkotlinx/coroutines/test/TestCoroutineContext;Lkotlin/jvm/functions/Function1;)V
public static synthetic fun withTestContext$default (Lkotlinx/coroutines/test/TestCoroutineContext;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
}

3 changes: 1 addition & 2 deletions kotlinx-coroutines-core/build.gradle
Expand Up @@ -274,8 +274,7 @@ tasks.jvmLincheckTest {
}

def commonKoverExcludes =
["kotlinx.coroutines.test.*", // Deprecated package for removal
"kotlinx.coroutines.debug.*", // Tested by debug module
["kotlinx.coroutines.debug.*", // Tested by debug module
"kotlinx.coroutines.channels.ChannelsKt__DeprecatedKt.*", // Deprecated
"kotlinx.coroutines.scheduling.LimitingDispatcher", // Deprecated
"kotlinx.coroutines.scheduling.ExperimentalCoroutineDispatcher" // Deprecated
Expand Down
260 changes: 0 additions & 260 deletions kotlinx-coroutines-core/jvm/src/test_/TestCoroutineContext.kt

This file was deleted.

Expand Up @@ -77,9 +77,6 @@ public class CoroutinesBlockHoundIntegration : BlockHoundIntegration {
for (method in listOf("clear", "peek", "removeFirstOrNull", "addLast")) {
allowBlockingCallsInside("kotlinx.coroutines.internal.ThreadSafeHeap", method)
}
// [addLastIf] is only used in [EventLoop.common]. Users of [removeFirstIf]:
allowBlockingCallsInside("kotlinx.coroutines.test.TestCoroutineDispatcher", "doActionsUntil")
allowBlockingCallsInside("kotlinx.coroutines.test.TestCoroutineContext", "triggerActions")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not directly related, but looking at this, I don't know how I feel about it being forbidden to do the test module's runCurrent and advance* from Dispatchers.Default when BlockHound is used, even if the operations themselves are completely fine. I don't think this is a realistic concern, but it still feels a bit semantically unclean.

}

private fun BlockHound.Builder.allowBlockingCallsInFlow() {
Expand Down