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

hundreds-breakfast-49010

07/18/2019, 9:07 PM
Does anyone know what the motivation is for the distinction between
FakeOptionValues
and
OptionValuesContainer
?
a

aloof-angle-91616

07/18/2019, 9:08 PM
one of them is more mockable
and used in testing
h

hundreds-breakfast-49010

07/18/2019, 9:09 PM
the old roots test is passing in an instance of
FakeOptionValues
to the
SourceRoot
, but my new one is passing in
OptionValuesContainer
so maybe i need to be mocking a
FakeOptionValues
somehow?
this is in
source_root.py
, in
create_trie()
a

aloof-angle-91616

07/18/2019, 9:18 PM
what do you need an
OptionValuesContainer
for?
the pants test framework is creating the
FakeOptionValues
for you
h

hundreds-breakfast-49010

07/18/2019, 9:19 PM
if I print the result of
self.get_options()
in
create_trie
when I run my new test, it's a value of type
OptionsValueContainer
, not of
FakeOptionValues
in the v1 test that is
FakeOptionValues
a

aloof-angle-91616

07/18/2019, 9:20 PM
yes
it looks like v2 may make it easier to mock things like options and require fewer hacks
h

hundreds-breakfast-49010

07/18/2019, 9:20 PM
so somehow I'm not setting the options that I need in teh v2 test
a

aloof-angle-91616

07/18/2019, 9:21 PM
what options do you need?
h

hundreds-breakfast-49010

07/18/2019, 9:21 PM
I think what the old test is doing is setting
--source-source-root
that call to
set_option_for_scope
is equivalent to passing
--source-source-root
at the command line, right?
a

aloof-angle-91616

07/21/2019, 2:04 AM
that’s correct!
sometimes some options have different precedences when the option is specified via the config file / command line / environment so be aware of that but i don’t think that’s relevant in this case