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

hundreds-breakfast-49010

07/18/2019, 12:53 AM
is that setting hte same options that you might invoke from the command line, that you register within calls to
register_options
?
a

aloof-angle-91616

07/18/2019, 12:54 AM
yes!
the command line or environment or pants.ini files
h

hundreds-breakfast-49010

07/18/2019, 12:55 AM
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

aloof-angle-91616

07/18/2019, 4:46 AM
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

hundreds-breakfast-49010

07/19/2019, 12:57 AM
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

witty-crayon-22786

07/26/2019, 3:52 AM
take a look at how the List test does it.
options are computed from an OptionsBootsrapper