-
Notifications
You must be signed in to change notification settings - Fork 87
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
Introduce test prelude #53
Conversation
What's the rationale for another package? Wouldn't the |
Yes, but the converse is not true: Not all components that depend on hydra-prelude need to depend on test-related stuff like it was the case previously with |
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.
Thanks. Some minor comments on what we could name different or move on top of this.
src | ||
exposed-modules: | ||
Hydra.Test.Prelude | ||
Hydra.Network.Ports |
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.
Could: I would expect all modules of a package called "test-utils" to include some Test
in the module name. Furthermore, other packages used in tests typically start with Test
(e.g. Test.QuickCheck
) and maybe we could name the prelude then also Test.Hydra.Prelude
?
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.
Good point. I will rename the Ports
module. I am fine withTest.Hydra.XXX
prefix, will do that renaming too.
import Network.WebSockets (Connection, receiveData, runClient, sendBinaryData) | ||
import Test.Hspec | ||
import Test.Hspec.QuickCheck (prop) | ||
import Test.QuickCheck (cover) | ||
import Test.QuickCheck.Monadic (monadicIO, monitor, run) | ||
import Test.Util (failAfter, failure) | ||
import Hydra.ServerOutput (ServerOutput (InvalidInput, ReadyToCommit)) | ||
import Test.Util (failAfter) |
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.
Could: failAfter
would also be a good candidate for the Test.Prelude
We provide a dedicated package for tests in order to not add more dependencies to production code when test dependencies are not needed.
Also, replace use of expectationFailure with failure which provides better error reporting.
And replace another definition of failAfter
5990450
to
63e5bdc
Compare
This is a very simple PR that introduces a
hydra-test-utils
package which exposes aHydra.Test.Prelude
module and thePorts
module previously from hydra-prelude.I did not move code related to io-sim (from
Test.Util
) but I think it would fit in there.