Trying to debug a rule graph error, does this patt...
# development
h
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
can't say much without seeing what the diff is, can you post it?
h
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
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
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
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
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
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
I figured maybe you could use junit to run jvm tests in other languages
h
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
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
oh woah
h
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
I think that the decorator could probably error in this case...? Where it isn't being applied to anything...?
👍 1
h
Chris might know how to do that when he gets back from vacation, given his decorators talk