James G. Sack (jim) wrote: > Tracy R Reed wrote: >> .. >> So I wrote LOLLERSKATES. It is simple, easy to configure, and has macros >> so I can fully match a proper IP address without having to always type >> in that huge regex which matches IP's. > > Seems like a clean and useful approach to me! I had no trouble > understanding what it does or how to use it. > >> .. >> Unit tests? It's already written so I don't know if that would serve >> much point. I'm not sure how I would written implemented unit tests to >> begin with. > > There has already been some discussion on this, but I thought I might > just jump in and write some actual code to illustrate my somewhat messy, > simple-minded, personal approach. > > So here's a _start_ on a unittest for lollerskates, that at least may > show how to use unittest.py without too much worrying about frameworks. > > Just import unittest and follow some simple recipes. The only thing you > have to look up in the docs is the names of the "assertXXX" functions -- > you can get a lot of mileage from assertTrue(), but to tell the truth, I > haven't written what anyone would call a lot of python unittests. > > I enclose a tarball including my t_lollerskates.py, and some mods to the > config and ignore file -- and a couple of changes to lollerskates.py, > for debugging, as well as to make some functions callable (I initialized > VERBOSE, globally). I've put the code in a subdir jloller and only look > at /var/log/dmesg. My statefiles are in jloller/states. Anyway it > shouldn't damage anything, and doesn't require root. > > Everyone will probably recognize that this is far from a "finished" > test, but I just meant to show a recipe for getting _something_ begun, > and it might serve as a point for further discussion. > > I did put some TODO/FIXME/thinking notes at the top of the t_.. file. > > ..jim > ahhh, no attachments allowed, I guess? Goto http://www.kernel-panic.org/Members/jgsack/misc/jloller.tgz
..jim -- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg
