https://pantsbuild.org/ logo
#general
Title
# general
h

hundreds-breakfast-49010

11/14/2019, 9:39 PM
is there an easy way to make that happen?
e

enough-analyst-54434

11/14/2019, 10:55 PM
Perhaps the easiest is to call the plugin API
rules()
functions:
Copy code
$ find . -name "register.py" | xargs grep "def rules()"
./src/python/pants/rules/core/register.py:def rules():
./src/python/pants/backend/native/register.py:def rules():
./src/python/pants/backend/project_info/register.py:def rules():
./src/python/pants/backend/python/register.py:def rules():
./pants-plugins/src/python/internal_backend/rules_for_testing/register.py:def rules():
w

witty-crayon-22786

11/15/2019, 11:00 PM
@hundreds-breakfast-49010: that would essentially be an integration test... are you sure you want that?
h

hundreds-breakfast-49010

11/15/2019, 11:01 PM
@witty-crayon-22786 nope, I worked around it
w

witty-crayon-22786

11/15/2019, 11:01 PM
cool
a

aloof-angle-91616

11/16/2019, 1:25 AM
@hundreds-breakfast-49010 i would like it to be feasible to use
def rules()
from individual `register.py`s for this purpose as @enough-analyst-54434 describes -- if that is more annoying than it needs to be, let's consider how those could be rearranged to make them more useful imho!
h

hundreds-breakfast-49010

11/16/2019, 1:26 AM
which ultimately I was able to write without using the actual rule graph
👍 1
a

aloof-angle-91616

11/16/2019, 1:27 AM
ah amazing!
thank you!
h

hundreds-breakfast-49010

11/16/2019, 1:27 AM
I'm not sure how much effort I would've had to put into making a self-consistent rule graph if I had gone with john's suggestion
a

aloof-angle-91616

11/16/2019, 1:28 AM
hopefully we can eventually make it consistent
i think your approach is actually what we would prefer in most cases if it doesn't require too many mocks/hacks
h

hundreds-breakfast-49010

11/16/2019, 1:28 AM
yeah for this specific test using mock rules works, but your point is still valid
👍 1
a

aloof-angle-91616

11/16/2019, 1:29 AM
in my head this is an open problem to be resolved eventually
there's still a lot of fun stuff we can do with testing rules