| 1 |
|
| 2 |
|
| 3 |
""" |
| 4 |
Note that the functional tests and doctests require test-tools to be on |
| 5 |
sys.path before the stdlib. One way to ensure that is to use this script to |
| 6 |
run tests. |
| 7 |
""" |
| 8 |
|
| 9 |
import os |
| 10 |
import sys |
| 11 |
|
| 12 |
|
| 13 |
def mutate_sys_path(): |
| 14 |
this_dir = os.path.dirname(__file__) |
| 15 |
sys.path.insert(0, os.path.join(this_dir, "test")) |
| 16 |
sys.path.insert(0, os.path.join(this_dir, "test-tools")) |
| 17 |
sys.path.insert(0, os.path.join(this_dir, "mechanize")) |
| 18 |
|
| 19 |
|
| 20 |
def run_tests(test_names=()): |
| 21 |
pass |
| 22 |
|
| 23 |
|
| 24 |
def main(argv): |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
mutate_sys_path() |
| 39 |
assert "doctest" not in sys.modules |
| 40 |
import testprogram |
| 41 |
|
| 42 |
|
| 43 |
this_dir = os.path.dirname(__file__) |
| 44 |
prog = testprogram.TestProgram( |
| 45 |
argv=argv, default_discovery_args=(this_dir, "*.py", None), |
| 46 |
module=None) |
| 47 |
result = prog.runTests() |
| 48 |
success = result.wasSuccessful() |
| 49 |
sys.exit(int(not success)) |
| 50 |
|
| 51 |
|
| 52 |
if __name__ == "__main__": |
| 53 |
main(sys.argv) |