bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
608
by Martin Pool
- Split selftests out into a new module and start changing them |
1 |
# Copyright (C) 2005 by Canonical Ltd
|
2 |
||
3 |
# This program is free software; you can redistribute it and/or modify
|
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
7 |
||
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
||
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program; if not, write to the Free Software
|
|
15 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
16 |
||
|
609
by Martin Pool
- cleanup test code |
17 |
|
|
720
by Martin Pool
- start moving external tests into the testsuite framework |
18 |
from unittest import TestResult, TestCase |
|
719
by Martin Pool
- reorganize selftest code |
19 |
|
|
720
by Martin Pool
- start moving external tests into the testsuite framework |
20 |
class _MyResult(TestResult): |
|
719
by Martin Pool
- reorganize selftest code |
21 |
# def startTest(self, test):
|
22 |
# print str(test).ljust(50),
|
|
|
720
by Martin Pool
- start moving external tests into the testsuite framework |
23 |
# TestResult.startTest(self, test)
|
|
719
by Martin Pool
- reorganize selftest code |
24 |
|
25 |
# def stopTest(self, test):
|
|
26 |
# print
|
|
|
720
by Martin Pool
- start moving external tests into the testsuite framework |
27 |
# TestResult.stopTest(self, test)
|
|
719
by Martin Pool
- reorganize selftest code |
28 |
|
29 |
||
30 |
pass
|
|
31 |
||
32 |
||
33 |
||
|
720
by Martin Pool
- start moving external tests into the testsuite framework |
34 |
|
|
608
by Martin Pool
- Split selftests out into a new module and start changing them |
35 |
def selftest(): |
|
719
by Martin Pool
- reorganize selftest code |
36 |
from unittest import TestLoader, TestSuite |
37 |
import bzrlib |
|
38 |
import bzrlib.whitebox |
|
|
720
by Martin Pool
- start moving external tests into the testsuite framework |
39 |
import bzrlib.blackbox |
|
719
by Martin Pool
- reorganize selftest code |
40 |
from doctest import DocTestSuite |
41 |
||
42 |
suite = TestSuite() |
|
|
720
by Martin Pool
- start moving external tests into the testsuite framework |
43 |
tl = TestLoader() |
44 |
||
45 |
for m in bzrlib.whitebox, bzrlib.blackbox: |
|
46 |
suite.addTest(tl.loadTestsFromModule(m)) |
|
47 |
||
|
719
by Martin Pool
- reorganize selftest code |
48 |
for m in bzrlib.store, bzrlib.inventory, bzrlib.branch, bzrlib.osutils, \ |
49 |
bzrlib.commands: |
|
50 |
suite.addTest(DocTestSuite(m)) |
|
51 |
||
52 |
result = _MyResult() |
|
53 |
suite.run(result) |
|
54 |
||
55 |
print '%4d tests run' % result.testsRun |
|
56 |
print '%4d errors' % len(result.errors) |
|
57 |
print '%4d failures' % len(result.failures) |
|
58 |
||
59 |
return result.wasSuccessful() |
|
60 |