Skip to content

Refactor timeout handling in AndroidJUnit4ClassRunner.#2481

Open
copybara-service[bot] wants to merge 1 commit intomainfrom
piper_903547390
Open

Refactor timeout handling in AndroidJUnit4ClassRunner.#2481
copybara-service[bot] wants to merge 1 commit intomainfrom
piper_903547390

Conversation

@copybara-service
Copy link
Copy Markdown

Refactor timeout handling in AndroidJUnit4ClassRunner.

This change replaces the use of JUnit's FailOnTimeout with a custom implementation that ensures @before, @test, and @after methods run on the same thread. The previous FailOnTimeout would execute only the @test method in a separate thread, potentially causing issues with thread-local state. The new implementation wraps the entire test block (including Before/After) in a separate thread when a timeout is active, preserving thread locality within the test lifecycle.

This change replaces the use of JUnit's FailOnTimeout with a custom implementation that ensures @before, @test, and @after methods run on the same thread. The previous FailOnTimeout would execute only the @test method in a separate thread, potentially causing issues with thread-local state. The new implementation wraps the entire test block (including Before/After) in a separate thread when a timeout is active, preserving thread locality within the test lifecycle.

PiperOrigin-RevId: 903547390
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.

1 participant