-
Notifications
You must be signed in to change notification settings - Fork 654
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
tests hygiene: a lot fewer naked try
s
#552
Conversation
65fe495
to
e3d543d
Compare
Motivation: Naked `try`s in tests are a problem because if they're hit you'll get a bad error message and likely no file/line information. That has made many flaky tests harder to debug than necessary. Modifications: - fix a lot of naked `try`s - symlink `TestUtils` from `NIOTests` into `NIOHTTP1Tests` - make a bunch of `wait()`s synchronous that were asynchronous by accident Result: - better code - easier to debug test failures - setting better example
e3d543d
to
854eea7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor structural note, I'm otherwise happy with this.
@@ -0,0 +1 @@ | |||
../NIOTests/TestUtils.swift |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than create this symlink, should we just move this into a target and depend on it from the two test targets?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Lukasa SwiftPM doesn't unfortunately support that AFAIK. We can't make it a test target as we can't depend on that and we can't make it a normal target as it depends on XCTest
. Therefore this is the only way I'm aware of...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh, ok then.
Motivation: Naked `try`s in tests are a problem because if they're hit you'll get a bad error message and likely no file/line information. That has made many flaky tests harder to debug than necessary. Modifications: - fix a lot of naked `try`s - symlink `TestUtils` from `NIOTests` into `NIOHTTP1Tests` - make a bunch of `wait()`s synchronous that were asynchronous by accident Result: - better code - easier to debug test failures - setting better example Motivation: Explain here the context, and why you're making that change. What is the problem you're trying to solve. Modifications: Describe the modifications you've done. Result: After your change, what will change.
Motivation:
Naked
try
s in tests are a problem because if they're hit you'll get abad error message and likely no file/line information. That has made
many flaky tests harder to debug than necessary.
Modifications:
try
sTestUtils
fromNIOTests
intoNIOHTTP1Tests
wait()
s synchronous that were asynchronous byaccident
Result: