Mercurial > hg > MakeItSo
annotate examples/test.py @ 227:8ee4ff7a89c7
one more time
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Mon, 14 Dec 2015 14:07:06 -0800 |
parents | 6b4c8f23192f |
children |
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() |