witty-crayon-22786
09/20/2019, 11:11 PMwitty-crayon-22786
09/20/2019, 11:11 PMenough-analyst-54434
09/20/2019, 11:13 PMenough-analyst-54434
09/20/2019, 11:13 PMenough-analyst-54434
09/20/2019, 11:14 PMwitty-crayon-22786
09/20/2019, 11:14 PMsuper
witty-crayon-22786
09/20/2019, 11:15 PMenough-analyst-54434
09/20/2019, 11:15 PMenough-analyst-54434
09/20/2019, 11:15 PMwitty-crayon-22786
09/20/2019, 11:15 PMwitty-crayon-22786
09/20/2019, 11:16 PMenough-analyst-54434
09/20/2019, 11:16 PMwitty-crayon-22786
09/20/2019, 11:16 PMwitty-crayon-22786
09/20/2019, 11:16 PMwitty-crayon-22786
09/20/2019, 11:16 PMrun_rule
...witty-crayon-22786
09/20/2019, 11:17 PMenough-analyst-54434
09/20/2019, 11:17 PMenough-analyst-54434
09/20/2019, 11:17 PMenough-analyst-54434
09/20/2019, 11:17 PMwitty-crayon-22786
09/20/2019, 11:18 PMrun_rule
is the most unity of unit tests. example: https://github.com/pantsbuild/pants/blob/5e1d797b0542d5c1e37efcad7375dd816ecf63e9/tests/python/pants_test/engine/test_build_files.py#L29-L36witty-crayon-22786
09/20/2019, 11:18 PMwitty-crayon-22786
09/20/2019, 11:19 PMrun_rule
requires no scheduler, and no other ruleswitty-crayon-22786
09/20/2019, 11:19 PMenough-analyst-54434
09/20/2019, 11:19 PMrun_rule
, just call the function. Unless run_rule
mocks Gets which is probably what it does,witty-crayon-22786
09/20/2019, 11:19 PMwitty-crayon-22786
09/20/2019, 11:19 PMenough-analyst-54434
09/20/2019, 11:20 PMwitty-crayon-22786
09/20/2019, 11:20 PMhundreds-breakfast-49010
09/20/2019, 11:22 PMrun_rule
requires providing mocks for every yield Get
anywhere in the rule or any subrules it uses?hundreds-breakfast-49010
09/20/2019, 11:22 PMenough-analyst-54434
09/20/2019, 11:23 PMenough-analyst-54434
09/20/2019, 11:23 PMhundreds-breakfast-49010
09/20/2019, 11:23 PMTestBase
that define a rules()
clss function and basically run a minimal rule graphhundreds-breakfast-49010
09/20/2019, 11:24 PMHydratedTarget
hundreds-breakfast-49010
09/20/2019, 11:24 PM@rule
ought to bewitty-crayon-22786
09/20/2019, 11:25 PManywhere in the ruleyes
or any subrules it usesno
witty-crayon-22786
09/20/2019, 11:26 PMenough-analyst-54434
09/20/2019, 11:27 PMor any subrules it usesIs right in spirit correct, but maybe spelling is wrong? A Get maps to a rule in the end
witty-crayon-22786
09/20/2019, 11:27 PMrun_rule
... you provide the computation of the result value of the yieldenough-analyst-54434
09/20/2019, 11:27 PMwitty-crayon-22786
09/20/2019, 11:27 PMrun_rule
witty-crayon-22786
09/20/2019, 11:28 PMaddress_mapper = AddressMapper(JsonParser(TEST_TABLE))
af = run_rule(parse_address_family, address_mapper, Dir('/dev/null'), {
(Snapshot, PathGlobs): lambda _: Snapshot(Digest('abc', 10), ('/dev/null/BUILD',), ()),
(FilesContent, Digest): lambda _: FilesContent([FileContent('/dev/null/BUILD', b'', False)]),
})
self.assertEqual(len(af.objects_by_name), 0)
witty-crayon-22786
09/20/2019, 11:28 PMyield
statements in the parse_address_family
ruleenough-analyst-54434
09/20/2019, 11:28 PMenough-analyst-54434
09/20/2019, 11:28 PMwitty-crayon-22786
09/20/2019, 11:29 PMwitty-crayon-22786
09/20/2019, 11:29 PMenough-analyst-54434
09/20/2019, 11:29 PMwitty-crayon-22786
09/20/2019, 11:29 PM