# HG changeset patch # User Oleg Oshmyan # Date 1294012082 -7200 # Node ID 1bee3a0beeb588d6fef30b9f22dd26e704f24ea9 # Parent b9d5857f7b9a461f42bb028158f77206a752521a Added a 'Sample total' line when using test groups diff -r b9d5857f7b9a -r 1bee3a0beeb5 testcases.py --- a/testcases.py Mon Jan 03 01:27:56 2011 +0200 +++ b/testcases.py Mon Jan 03 01:48:02 2011 +0200 @@ -663,6 +663,13 @@ # like the exit code of an output validator is used. +class DummyTestContext(problem.TestGroup): + __slots__ = () + def end(self): + say('Sample total: %d/%d tests' % (self.ncorrect, self.ntotal)) + return self.log + + def load_problem(prob, _types={'batch' : BatchTestCase, 'outonly' : OutputOnlyTestCase, 'bestout' : BestOutputTestCase, @@ -707,9 +714,11 @@ for i in group: s = str(i).zfill(prob.config.padtests) prob.cache.padoutput = max(prob.cache.padoutput, len(s)) + yield DummyTestContext() for i in prob.config.dummies: s = str(i).zfill(prob.config.paddummies) yield _types[prob.config.kind](prob, s, True, 0) + yield problem.test_context_end for group in prob.config.tests: yield problem.TestGroup() for i in group: