On Fri, Oct 21, 2011 at 11:18 AM, Jeff Forcier <[email protected]> wrote: >> On Fri, Oct 21, 2011 at 11:17 AM, Ahsan Rabbani <[email protected]> wrote: >> >> So for example, if I call a >> task that is decorated with @hosts (and has multiple hosts defined) it would >> be nice if it got invoked once for each host defined. > > After 1.3 is released (any day now) you'll be able to use the > execute() function for this purpose, so replacing your task object > with a Mock, decorating it with @hosts, and throwing it into > execute(), should behave the way you need it to. > > >> Afterwards, ironfroggy said: >> >> I admit, I don't test them. Not with unit tests, and I'm guessing most >> people don't. The fabfile.py seems outside of "real code" and escapes >> the expectation of testing, sadly. I think this should be corrected. >> One thing I"m trying to do more is create temporary test servers with >> vagrant to do local operations on and test this stuff out better. > > Fabric actually ships with a somewhat crude fake SSH server leveraging > Paramiko's server-side code, and we use it widely in our own test > suite. There are vague plans to try and clean this up and release it > as its own library, but for now, you may still find it useful to check > out. > > At the moment it can only do simple input/response, e.g. > @server({'this command should': ('return this stdout', 'this stderr, > and return code', 3)}) -- there's no state or any attempt at > implementing "real" unix commands. But this would probably get many > folks 80% of the way there re: testing fabfiles. > > For complex fabfiles, using something like Vagrant is always a good > option, if slightly more time-consuming (i.e. it's not a great fit for > CI or rapid test iteration.) > > Best, > Jeff > > -- > Jeff Forcier > Unix sysadmin; Python/Ruby engineer > http://bitprophet.org > > _______________________________________________ > Fab-user mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/fab-user >
I haven't done Vagrant testing with my work production fabric stuff but I have used it to test personal fabric scripts cross platform. It works really well for that but isn't ideal for unit testing. -Wraithan _______________________________________________ Fab-user mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/fab-user
