polite-garden-50641
07/07/2020, 10:44 PMwitty-crayon-22786
07/07/2020, 10:51 PM@rules
witty-crayon-22786
07/07/2020, 10:52 PMrun_rule
: https://github.com/pantsbuild/pants/blob/179dbc9a7e496025d32fd4d0e8bc7dbfa2ffacca/src/python/pants/engine/internals/build_files_test.py#L43-L63 … you must mock everything that a rule uses with run_rule
(edit: switched to John’s example since he’s right that it’s better for this case)witty-crayon-22786
07/07/2020, 10:52 PMPantsRunIntegrationTest
, which subprocesses pants.witty-crayon-22786
07/07/2020, 10:53 PMwitty-crayon-22786
07/07/2020, 10:53 PMrun_rule
enough-analyst-54434
07/07/2020, 10:54 PMwitty-crayon-22786
07/07/2020, 10:55 PMTestBase.request_single_product
to run your rule… to do that you need to install all of the other rules that it needs, or mocked replacements*: https://github.com/pantsbuild/pants/blob/e5eed259f5e21a81ef99efc37074b05a7c2f2952/tests/python/pants_test/backend/python/test_pants_requirement.py#L29-L49witty-crayon-22786
07/07/2020, 10:56 PMrun_rule
or request_single_product
depending on how much other stuff you want to mock out.witty-crayon-22786
07/07/2020, 11:01 PMpolite-garden-50641
07/07/2020, 11:07 PM