-
-
Notifications
You must be signed in to change notification settings - Fork 649
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
Move MockOptions into testutil library #9086
Conversation
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.
I'm not convinced that this is how we want to mock a GoalSubsystem
. For example, we might want to leverage the prior art of init_subsystem
. I think we should wait to see if we can come up with anything better.
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.
Great thinking!
@@ -170,6 +171,13 @@ def remove_locations_from_traceback(trace): | |||
return new_trace | |||
|
|||
|
|||
class MockOptions: | |||
"""Test mock for any options type.""" |
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.
"""Test mock for any options type.""" | |
"""Test mock for any `Optionable` subclass.""" |
I agree with this in theory, but it has also been super annoying to correctly use |
Ideally, a solution will fix this: pants/src/python/pants/engine/goal_test.py Lines 14 to 40 in e52a044
If we use I won't block on this, and do appreciate trying to make testing a better experience, only don't want to put something in a public API until we explored other possibilities. |
I think the above argument is reasonable enough. Is it clear how to rewrite the tests in |
Superseded by John creating a proper utility in #9528. |
The test for the v2
test
goal defines aMockOptions
type since it specifically needs to create an options mock. But this is really a more general piece of functionality that ought to live in a testutil library so other test files can make use of it.