/[thuban]/branches/WIP-pyshapelib-bramz/test/runtests.py
ViewVC logotype

Annotation of /branches/WIP-pyshapelib-bramz/test/runtests.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1377 - (hide annotations)
Tue Jul 8 10:54:16 2003 UTC (21 years, 8 months ago) by bh
Original Path: trunk/thuban/test/runtests.py
File MIME type: text/x-python
File size: 2262 byte(s)
(main): Make the default output less verbose
and add a verbosity option (-v) to get the old output

1 bh 597 # Copyright (c) 2002, 2003 by Intevation GmbH
2 bh 292 # Authors:
3     # Bernhard Herzog <[email protected]>
4     #
5     # This program is free software under the GPL (>=v2)
6     # Read the file COPYING coming with Thuban for details.
7    
8     """
9     Main entry point for the Thuban test suite.
10    
11     Just run this file as a python script to execute all tests
12     """
13    
14 bh 1269 __version__ = "$Revision$"
15     # $Source$
16     # $Id$
17 bh 292
18     import os, sys
19 bh 1219 import warnings
20 bh 292 import unittest
21 bh 1377 import getopt
22 bh 292
23     import support
24     support.initthuban()
25     import Thuban.Lib.connector
26    
27     def main():
28     """Run all the tests in the Thuban test suite"""
29    
30 bh 1219 # Turn Thuban's deprecation warnings into errors so they're cought
31     # by the tests
32     #
33     # Maintenance: Keep a warning filter until the backwards
34     # compatibility code is removed at which time using the old
35     # interfaces should lead to other errors anyway.
36    
37     # The layer attributes table, shapetable, shapefile and filename are
38     # deprecated.
39     warnings.filterwarnings("error", "The Layer attribute.*is deprecated",
40     DeprecationWarning)
41    
42     # Usage of the old table interface. This old interface is still used
43     # by the test_table.py module which calls filterwarnings too to
44     # ignore the warnings issued by its own intended use of the old
45     # interface.
46     warnings.filterwarnings("error", ".*old table interface.*",
47     DeprecationWarning)
48    
49 bh 1377 verbosity = 1
50 bh 1219
51 bh 1377 opts, args = getopt.getopt(sys.argv[1:], 'v', ['verbose'])
52     for optchar, value in opts:
53     if optchar in ("-v", "--stub-auto-login"):
54     verbosity = 2
55     print>>sys.stderr, "Unknown option", optchar
56    
57 bh 1219 # All Python files starting with test in the current directory
58     # contain test cases.
59     # FIXME: It should be possible to run runtests.py even when not in
60     # the test directory
61 bh 292 files = os.listdir(os.curdir)
62     names = []
63     for file in files:
64     if file[:4] == "test" and file[-3:] == ".py":
65     names.append(file[:-3])
66    
67     suite = unittest.defaultTestLoader.loadTestsFromNames(names)
68 bh 1377 runner = unittest.TextTestRunner(verbosity = verbosity)
69 bh 292 result = runner.run(suite)
70    
71 bh 1245 support.print_additional_summary()
72 bh 292
73     sys.exit(not result.wasSuccessful())
74    
75    
76     if __name__ == "__main__":
77     main()

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26