On Friday, November 02, 2012 10:56:07 AM David Malcolm wrote: > On Thu, 2012-11-01 at 11:20 -0400, Paul Moore wrote: > > ---------- Forwarded Message ---------- > > > > Subject: [RFC PATCH v2 3/3] tests: add python versions of the existing > > tests Date: Thursday, November 01, 2012, 11:18:29 AM > > From: Paul Moore <[email protected]> > > To: [email protected] > > CC: [email protected], [email protected] > > [...] > > > diff --git a/tests/01-allow.py b/tests/01-allow.py > > [...] > > > + > > +import argparse > > +import sys > > + > > +from util import * > > If you do my suggested name change in the other email, this could become > just: > > import util > > [...snip...] > > args = util.get_opt() > ctx = test(args) > util.filter_output(args, ctxt) > > instead of > > > +args = UtilGetOpt() > > +ctx = test(args) > > +UtilFilterOutput(args, ctx)
I guess I don't see a major difference with either solution ... is it considered "un-Pythonic" to do "from foo import *"? > But given how every test has the same pattern, it seems simpler to have > this in util.py: > > def main(test): > args = get_opt() > ctx = test(args) > filter_output(args, ctxt) > > and then have this in every test: > > -------------------------- > import util > > def test(args): > # body of test > > util.main(test) > -------------------------- > > so that you simply pass the test function in as an argument to > util.main, and have the harness logic in one place. While it is true that *many* of the tests follow the format above, all of them do not (see tests/11-basic-errors.py for one example) so I don't want to push that behavior into the util module. -- paul moore security and virtualization @ redhat ------------------------------------------------------------------------------ LogMeIn Central: Instant, anywhere, Remote PC access and management. Stay in control, update software, and manage PCs from one command center Diagnose problems and improve visibility into emerging IT issues Automate, monitor and manage. Do more in less time with Central http://p.sf.net/sfu/logmein12331_d2d _______________________________________________ libseccomp-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libseccomp-discuss
