[Scons-users] creating a clean directory in the build

Tom Tanner (BLOOMBERG/ LONDON) ttanner2 at bloomberg.net
Mon Jan 5 09:04:02 EST 2015


One of the things I want to do in our build is to create a clean directory for unit tests to run in and generate any temporary files (as the only "interesting" result from a unit test is whether or not it passed) so it can be cleaned before running the unit test in order to ensure it starts from a consistent state (yes, we do have issues and at the moment some unit tests clean up before they start in case they failed and some don't).

So I was going to do somthing that did something like

command = [ Delete(test_dir), Mkdir(test dir), other stuff ]
command.append(run unit test)

but I wanted to implement my own Prepare function as 'other stuff' isn't always trivial, and I only want to print one message.

so I'd do the python equivalent of Delete and Mkdir so I looked in code for Delete and Mkdir and I saw this:

def delete_func(dest, must_exist=0):
SCons.Node.FS.invalidate_node_memos(dest)

So I'm not sure if I need to replicate that. The directory in question is only creaetd and populated as the result of the unit test and it and its contents aren't build targets, so I hope it is.

As a separate question, if I do

command = [ Scons.Action.ActionFactory(myfunc, mystrfunc) ]

how do I ensure that changes to myfunc cause the build to change? my experiments so far indicates it doesn't.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20150105/111639b6/attachment.html>


More information about the Scons-users mailing list