[Scons-users] How to reset the global state?
Dirk Bächle
tshortik at gmx.de
Thu Apr 24 12:09:10 EDT 2014
Hi Björn,
On 24.04.2014 14:19, Björn Pollex wrote:
> I am currently trying to write some unit-tests for a custom SCons
> tool. The setup looks a bit like this:
>
> from SCons.Environment import Environment
>
> def test_something():
> env = Environment(tools=['my_custom_tool'])
> t, = env.MyCustomBuilder(args...)
> assert 'something' in t.get_build_env()
>
> def test_something_else():
> env = Environment(tools=['my_custom_tool'])
> t, = env.MyCustomBuilder(args...)
> assert 'something_else' in t.get_build_env()
>
> This is made up. The important part is, I try to build the same node
> multiple times in different tests. When I run each of the tests alone,
> they all pass. However, when I run the entire test module, SCons
> complains that it has multiple ways to build the same target when it
> runs the second test case.
>
does "complains" mean you get an error, or simply a warning (a copy of
the exact message would have been helpful)?
In a single SCons run, each file/target is unique regarding its absolute
filepath. You can't create the same file with different settings, like a
changed environment or a different action for your Builder.
> So the question seems to be, how can I reset that global state of
> SCons between test cases?
>
There is no state to reset, you'll have to restructure your build, e.g.
appending a suffix "_test1", "test_2",... to each single executable or
using variant dirs.
Hope this helps you a little further.
Best regards,
Dirk
More information about the Scons-users
mailing list