Mercurial > hg
annotate tests/heredoctest.py @ 15366:06b8db3f25c6 stable
largefiles: test reverting largefiles (coverage creeping ever upwards)
This reveals a small bug: revert reports "reverting .hglf/largefile"
when it really should report "reverting largefile". I don't see an
easy fix, though (short of using ui.pushbuffer() to interfere with
revert's output).
author | Greg Ward <greg@gerg.ca> |
---|---|
date | Tue, 25 Oct 2011 08:56:59 -0400 |
parents | 3cd1605e9d8e |
children | 474279be5add |
rev | line source |
---|---|
15235
f7044da7a793
tests: add helper script for processing doctests read from stdin
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
1 import doctest, tempfile, os, sys |
f7044da7a793
tests: add helper script for processing doctests read from stdin
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
2 |
f7044da7a793
tests: add helper script for processing doctests read from stdin
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
3 if __name__ == "__main__": |
f7044da7a793
tests: add helper script for processing doctests read from stdin
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
4 fd, name = tempfile.mkstemp(suffix='hg-tst') |
15247
3cd1605e9d8e
tests: remove temp doctest file when finished running it
Idan Kamara <idankk86@gmail.com>
parents:
15235
diff
changeset
|
5 |
3cd1605e9d8e
tests: remove temp doctest file when finished running it
Idan Kamara <idankk86@gmail.com>
parents:
15235
diff
changeset
|
6 try: |
3cd1605e9d8e
tests: remove temp doctest file when finished running it
Idan Kamara <idankk86@gmail.com>
parents:
15235
diff
changeset
|
7 os.write(fd, sys.stdin.read()) |
3cd1605e9d8e
tests: remove temp doctest file when finished running it
Idan Kamara <idankk86@gmail.com>
parents:
15235
diff
changeset
|
8 os.close(fd) |
3cd1605e9d8e
tests: remove temp doctest file when finished running it
Idan Kamara <idankk86@gmail.com>
parents:
15235
diff
changeset
|
9 failures, _ = doctest.testfile(name, module_relative=False) |
3cd1605e9d8e
tests: remove temp doctest file when finished running it
Idan Kamara <idankk86@gmail.com>
parents:
15235
diff
changeset
|
10 if failures: |
3cd1605e9d8e
tests: remove temp doctest file when finished running it
Idan Kamara <idankk86@gmail.com>
parents:
15235
diff
changeset
|
11 sys.exit(1) |
3cd1605e9d8e
tests: remove temp doctest file when finished running it
Idan Kamara <idankk86@gmail.com>
parents:
15235
diff
changeset
|
12 finally: |
3cd1605e9d8e
tests: remove temp doctest file when finished running it
Idan Kamara <idankk86@gmail.com>
parents:
15235
diff
changeset
|
13 os.remove(name) |