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

happy-kitchen-89482

12/22/2021, 8:54 PM
Trying to debug a rule graph error, does this pattern ring any bells?
I made some changes in junit.py, and now I get
No installed rules return the type FooTestFieldSet
for every Foo except JUnit (ScalatestTestFieldSet, PythonTestFieldSet, Shunit2FieldSet)
I get 31 errors total, but those 3 seem to be the core of it.
The others also seem to be caused by all members of various unions except the ones added to the union in junit.py being unavailable
h

hundreds-father-404

12/22/2021, 8:58 PM
can't say much without seeing what the diff is, can you post it?
h

happy-kitchen-89482

12/22/2021, 9:00 PM
Posted the errors in a comment
AFAICT the change to junit.py is identical to the change in scalatest.py, but the latter alone works fine
I feel like I've made some obvious goof, but I can't find it, and the graph errors are... inscrutable
h

hundreds-father-404

12/22/2021, 9:02 PM
Can you isolate the error by commenting out the `Get`s inside of your functions like
setup_junit_debug_request
and
run_junit_test
? I don't see any errors..so the only idea I have is to try to isolate which line causes the issue
h

happy-kitchen-89482

12/22/2021, 9:21 PM
Yeah, been doing that, it makes no difference. The errors are related to the method signatures of the rules.
Anyway, was just hoping this is some well known pattern, where a union member "hides" all the other members somehow
Huh, commenting out
UnionRule(TestFieldSet, JunitTestFieldSet),
makes this go away
👍 1
Which is weird since I didn't add that, it was already there
h

hundreds-father-404

12/22/2021, 9:23 PM
What about commenting out Scala UnionRule but not Junit?
I think they both subclass the same parent, so it could be causing union weirdness
h

happy-kitchen-89482

12/22/2021, 9:25 PM
No, doesn't help
And those classes aren't related
Well, they both subclass
TestFieldSet
but that's normal
BTW why is junit.py in the core src/python/pants/jvm dir and not in the java backend?
h

hundreds-father-404

12/22/2021, 9:26 PM
Mistake, it shouldn't be! Because it's shared with both Java and Scala backends. NB that they both implement JUnit - there are two JUnit target types
h

happy-kitchen-89482

12/22/2021, 9:28 PM
I figured maybe you could use junit to run jvm tests in other languages
h

hundreds-father-404

12/22/2021, 9:29 PM
You could try commenting out either the Java or Scala Junit implementations and have only one of them. I wonder if that's at all related
w

witty-crayon-22786

12/22/2021, 9:33 PM
I figured maybe you could use junit to run jvm tests in other languages
yes: there are both
junit_tests
and
scala_junit_tests
the removal of the UnionRule for Java fixing this is a hint that it is localized to junit
👍 1
Copy code
rule(desc="Run JUnit", level=LogLevel.DEBUG)
async def run_junit_test(
    test_subsystem: TestSubsystem,
    field_set: JunitTestFieldSet,
) -> TestResult:
that is the first time i’ve ever seen that, but the fact that it is completely silent is Very Cool
the
@
is missing from the front of
@rule
👀 1
yea, that fixes it.
h

hundreds-father-404

12/22/2021, 9:39 PM
oh woah
h

happy-kitchen-89482

12/22/2021, 9:46 PM
God. Damn. It.
I need to go to bed.
😴 1
Good eyes!
Bleeeeeech, but thanks for helping me out
Anyway, that change now works, so we have debugging ability
w

witty-crayon-22786

12/22/2021, 9:54 PM
I think that the decorator could probably error in this case...? Where it isn't being applied to anything...?
👍 1
h

hundreds-father-404

12/22/2021, 9:56 PM
Chris might know how to do that when he gets back from vacation, given his decorators talk