Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/
Date: Wed, 03 Aug 2011 08:17:38
Message-Id: d2ff61dd7dafad1422326cfc81f2a118ed257dd2.mgorny@gentoo
1 commit: d2ff61dd7dafad1422326cfc81f2a118ed257dd2
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Wed Aug 3 08:18:28 2011 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Wed Aug 3 08:18:28 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=d2ff61dd
7
8 Support verbose mode, to always report assertions.
9
10 ---
11 pmstestsuite/cli.py | 12 +++++++++---
12 1 files changed, 9 insertions(+), 3 deletions(-)
13
14 diff --git a/pmstestsuite/cli.py b/pmstestsuite/cli.py
15 index 42ca98d..21e3e7b 100644
16 --- a/pmstestsuite/cli.py
17 +++ b/pmstestsuite/cli.py
18 @@ -59,6 +59,9 @@ class PMSTestSuiteCLI(object):
19 opt.add_option('-T', '--thorough', dest='thorough',
20 help='Run tests thoroughly (i.e. in all possible variants)',
21 action='store_true', default=False)
22 + opt.add_option('-v', '--verbose', dest='verbose',
23 + help='Report test results verbosely (even if they succeed)',
24 + action='store_true', default=False)
25
26 self.optparser = opt
27
28 @@ -111,6 +114,7 @@ class PMSTestSuiteCLI(object):
29
30 self.pm.package_limit = opts.limit_pkgs
31 self.update_manifests = not opts.no_manifests
32 + self.verbose = opts.verbose
33
34 limit_tests = set()
35 for t in opts.tests:
36 @@ -141,14 +145,16 @@ class PMSTestSuiteCLI(object):
37 self.all_done()
38
39 def all_done(self):
40 - if not self.failed:
41 + if not self.failed and not self.verbose:
42 print('%d tests completed successfully.' % len(self.test_library))
43 else:
44 print('%d of %d tests completed successfully, %d failed:'
45 % (len(self.test_library) - len(self.failed),
46 len(self.test_library), len(self.failed)))
47 - for t in self.failed:
48 - print('- %s' % t)
49 + tl = self.failed if not self.verbose else self.test_library
50 + for t in tl:
51 + print('- %s [%s]' % (t,
52 + 'OK' if t not in self.failed else 'FAILED'))
53 for a in t.assertions:
54 print '-> %s: %s [%s]' % (a.name, str(a),
55 'OK' if a else 'FAILED')