Hello, Am Montag, 13. April 2015 schrieb Steve Beattie: > On Sat, Apr 11, 2015 at 08:23:09PM +0200, Christian Boltz wrote: > > this patch adds setUp() to AATest that sets "self.maxDiff = None" > > (unlimited). This gives us unlimited array diffs everywhere where > > AATest is used. > > > > === modified file utils/test/common_test.py > > --- utils/test/common_test.py 2015-04-03 17:41:54.632932445 +0200 > > +++ utils/test/common_test.py 2015-04-11 20:06:33.272044715 +0200 > > @@ -39,6 +39,9 @@ > > > > class AATest(unittest.TestCase): > > + def setUp(self): > > + self.maxDiff = None > > + > > > > tests = [] > > > > class AAParseTest(unittest.TestCase): > This part, Acked-by: Steve Beattie <st...@nxnw.org>. > > > Also replace several setUp() functions in test-regex_matches.py that > > just set a class variable with setting the class variable directly. > > This avoids that the shiny new AATest setUp() gets overwritten. > > This part, NACK. This undoes the bit from > https://lists.ubuntu.com/archives/apparmor/2014-August/006276.html > (and acked in > https://lists.ubuntu.com/archives/apparmor/2014-September/006311.html > ).
Argh, I shouldn't have acked this ;-) Seriously: you have a good reason to keep it inside a function. > The better way to fix this I think would be to do e.g. > > > === modified file utils/test/test-regex_matches.py ... > > + super(AARegexTest, self).setUp() > Annoyingly, python2.7 requires explicit arguments, and when doing so, > it won't work to reference AATest directly if there's an intermediate > class in the hierarchy, like AARegexTest here (tested via using a > print() statement in AATest's setUp() method). So basically super() is (more or less) useless with py2 :-( - and in case it isn't, it has an annoying syntax. Here's a proposal as pseudo-patch: === modified file utils/test/common_test.py --- utils/test/common_test.py 2015-04-03 17:41:54.632932445 +0200 +++ utils/test/common_test.py 2015-04-11 20:06:33.272044715 +0200 class AATest(unittest.TestCase): + def setUp(self): + self.maxDiff = None + self.AASetup() + + def AASetup(self): + pass This would also mean to rename the setUp functions in test-regex_matches.py to AASetup. This avoids all problems with super() - even if it does it in a way that you probably don't like too much ;-) Would this solution be ok? If yes, I'll update the patch. Regards, Christian Boltz -- [dracut] I'm reluctant to waste time dealing with things like e.g. modules.d/90crypt/cryptroot-ask.sh. That feels like boot.crypto which was rightfully killed by systemd raising from the dead. [Ludwig Nussel in opensuse-packaging] -- AppArmor mailing list AppArmor@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor