is that setting hte same options that you might in...
# development
h
is that setting hte same options that you might invoke from the command line, that you register within calls to
register_options
?
a
yes!
the command line or environment or pants.ini files
h
so the calls in the test I'm trying to make work are of the form
self.set_options_for_scope('source', source_roots=source_root_dict)
but
--source
by itslef isn't an option, right?
but wait,
--source-source-roots
seems to be?
a
ah, sorry
./pants options | grep -i source
can sometimes be a useful way to find the option you want
i alternately do things like
rg -F '--source-roots'
in the pants repo because all pants options are registered with
register('--source-roots', ...)
(did you figure this out?)
h
no I didn't
as far as I can tell right now, with this set of debug prints: https://github.com/pantsbuild/pants/pull/8045/commits/eeb1ce5159f07e516d749f6dc54cfb39db22e2d0
when I run
/pants test tests/python/pants_test/backend/graph_info/tasks:root
(my new test), there is an options type being passed to
SourceRootConfig
of type
OptionValueContainer
, and it's trying to insert the go source roots
'src/go/src': ('go',), 'src/main/go/src': ('go',)}
whereas if I run
./pants test tests/python/pants_test/core_tasks:roots
(the old test)
the constructor of
SourceRootConfig
gets an options value of
_FakeOptionValues
(I'm printing the same variable each time)
and that correctly adds the source root
{'fakeroot': ('lang1', 'lang2')}
, which is what the test should be mocking
I cannot figure out 1) why my new test is getting a different options type than my old test or 2) how I sould be correclty instantiating the source root in the new version of the test
w
take a look at how the List test does it.
options are computed from an OptionsBootsrapper