annotate examples/test.py @ 103:a6aff990985b

do rudimentary interpretation of config files
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 11 Jan 2011 19:12:22 -0800
parents 6b4c8f23192f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
35
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 #!/usr/bin/env python
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
2
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3 """
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4 doctest runner
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5 """
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
6
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
7 import doctest
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
8 import os
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
9
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
10 def run_tests():
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
11 directory = os.path.dirname(os.path.abspath(__file__))
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
12 extraglobs = {'here': directory}
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
13 tests = [ 'doctest.txt' ]
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
14 for test in tests:
40
6b4c8f23192f test and fix mixed output case
Jeff Hammel <jhammel@mozilla.com>
parents: 35
diff changeset
15 doctest.testfile(test,
6b4c8f23192f test and fix mixed output case
Jeff Hammel <jhammel@mozilla.com>
parents: 35
diff changeset
16 optionflags=doctest.ELLIPSIS,
6b4c8f23192f test and fix mixed output case
Jeff Hammel <jhammel@mozilla.com>
parents: 35
diff changeset
17 extraglobs=extraglobs,
6b4c8f23192f test and fix mixed output case
Jeff Hammel <jhammel@mozilla.com>
parents: 35
diff changeset
18 raise_on_error=False)
35
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
19
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
20 if __name__ == '__main__':
7e47ff4b0cd3 started writing tests; what a surprise, everything is broken ;)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
21 run_tests()