{"action":"created","issue":{"url":"https://api.github.com/repos/google/openhtf/issues/196","repository_url":"https://api.github.com/repos/google/openhtf","labels_url":"https://api.github.com/repos/google/openhtf/issues/196/labels{/name}","comments_url":"https://api.github.com/repos/google/openhtf/issues/196/comments","events_url":"https://api.github.com/repos/google/openhtf/issues/196/events","html_url":"https://github.com/google/openhtf/pull/196","id":143690621,"number":196,"title":"Allow a phase to be reused with different kwargs","user":{"login":"fahhem","id":306100,"avatar_url":"https://avatars.githubusercontent.com/u/306100?v=3","gravatar_id":"","url":"https://api.github.com/users/fahhem","html_url":"https://github.com/fahhem","followers_url":"https://api.github.com/users/fahhem/followers","following_url":"https://api.github.com/users/fahhem/following{/other_user}","gists_url":"https://api.github.com/users/fahhem/gists{/gist_id}","starred_url":"https://api.github.com/users/fahhem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fahhem/subscriptions","organizations_url":"https://api.github.com/users/fahhem/orgs","repos_url":"https://api.github.com/users/fahhem/repos","events_url":"https://api.github.com/users/fahhem/events{/privacy}","received_events_url":"https://api.github.com/users/fahhem/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-03-26T11:12:05Z","updated_at":"2016-03-26T15:58:04Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/google/openhtf/pulls/196","html_url":"https://github.com/google/openhtf/pull/196","diff_url":"https://github.com/google/openhtf/pull/196.diff","patch_url":"https://github.com/google/openhtf/pull/196.patch"},"body":"This means you can parameterize a phase on something like a voltage to test at or which channel to check.\r\n\r\nIf this is considered beneficial, I would propose to extend this to the measurement names and docstrings like so:\r\n\r\n```py\r\n@measures(Measurement('current_at_%(volts)dV'))\r\ndef MeasureCurrent(test_data, volts=None):\r\n  yeah, well, you know that's just like\r\n  test_data.measurements['current_at_%d' % volts] = your opinion man\r\n\r\n...\r\n\r\nopenhtf.Test(\r\n    MeasureCurrent.WithArgs(volts=9),\r\n    MeasureCurrent.WithArgs(volts=12),\r\n    MeasureCurrent.WithArgs(volts=15), ...)\r\n```"},"comment":{"url":"https://api.github.com/repos/google/openhtf/issues/comments/201868674","html_url":"https://github.com/google/openhtf/pull/196#issuecomment-201868674","issue_url":"https://api.github.com/repos/google/openhtf/issues/196","id":201868674,"user":{"login":"grybmadsci","id":14081283,"avatar_url":"https://avatars.githubusercontent.com/u/14081283?v=3","gravatar_id":"","url":"https://api.github.com/users/grybmadsci","html_url":"https://github.com/grybmadsci","followers_url":"https://api.github.com/users/grybmadsci/followers","following_url":"https://api.github.com/users/grybmadsci/following{/other_user}","gists_url":"https://api.github.com/users/grybmadsci/gists{/gist_id}","starred_url":"https://api.github.com/users/grybmadsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grybmadsci/subscriptions","organizations_url":"https://api.github.com/users/grybmadsci/orgs","repos_url":"https://api.github.com/users/grybmadsci/repos","events_url":"https://api.github.com/users/grybmadsci/events{/privacy}","received_events_url":"https://api.github.com/users/grybmadsci/received_events","type":"User","site_admin":false},"created_at":"2016-03-26T15:58:04Z","updated_at":"2016-03-26T15:58:04Z","body":"Oh, one other thing that might be useful in conjunction with this (entirely up to you if you want to roll it in here or not, just throwing ideas out there) is the auto-flattening of iterables passed to the `Test()` constructor.  This would allow for easier constructs like:\r\n```\r\n  mytest = Test(\r\n    InitPhase,\r\n    (WavelengthPhase.WithArgs(wavelength=w) for w in conf.wavelengths),\r\n    DataCollectionPhase)\r\n```\r\nRight now, I'm manually building a `*args` using `itertools.chain` and the like, which isn't bad, but not ideal.  I think in either case, a test engineer without a strong python background is just going to copypasta it, but I think the syntax above is a whole lot easier to have an idea what's going on than calls into `itertools` and friends."}}