-
Notifications
You must be signed in to change notification settings - Fork 140
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
fixes tests for AsyncChannel which fail on iOS #186
Conversation
…eatures in XCTest
f9140c0
to
5bc43a1
Compare
|
Hi Shouldn’t that be part of the XCTest lib ? I guess this issue will happen for a lot of people out there. |
|
This seems like perhaps a bug in XCTest if it passes on macOS but not iOS. @briancroom are the existing XCTest expectations not a supported mechanism here? |
|
I haven't tried this particular piece of code, but I've experienced similar issues with my packages where a test method that's marked as Looking at the code change proposed, you wrapped the XCTWaiter's wait in an async/await API and are then calling It does look like a bug on XCTest expectations |
|
This might be caused due to the fact that the iOS simulator uses a cooperative thread pool size of 1. Using test expectations is then blocking this one thread probably which ends up wedging the test. (I haven't looked deeper into this just thought that this might be the reason) |
This appears to be the difference. Using a single expectation appears to work on iOS but more than 1 causes failures on iOS. The only async |
|
@FranzBusch What is causing the iOS simulator to have a thread pool size of 1? I do not see |
I think this is just how the iOS simulator is setup right now. I don't know any details why this is the case though. |
* moves test support code into XCTest target * improves implementation of AsyncExpectation * extends XCTestCase to add async functions * revises TestChannel tests with improved support code
|
I've revised the implementation of the test support to correct some logic bugs and also extended XCTestCase so functions can be used inline so code changes which deviate from XCTest are minimal. Tests pass on macOS and iOS when run once and also repeatedly 100 times. |
|
I am closing this PR for now since |
The original expectations features in XCTests are not fully compatible with iOS. The tests for AsyncChannel pass with macOS but not iOS.
This PR includes a new type called AsyncExpectation which provides an async version of
XCTestExpectationwhich has the features used in these tests. Migrating to this type required only small changes. AsyncTesting is a new package with this support for testing which includes tests for this functionality.With these changes the tests pass quickly on macOS and iOS.