Mercurial > hgsubversion
changeset 613:58f397523604
testrunner: delay and `simplify' importing of tests
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Fri, 14 May 2010 20:26:06 +0200 |
parents | 2c15e4c50a54 |
children | 4f6017ba4d3d |
files | tests/comprehensive/test_stupid_pull.py tests/run.py |
diffstat | 2 files changed, 38 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/comprehensive/test_stupid_pull.py +++ b/tests/comprehensive/test_stupid_pull.py @@ -5,7 +5,13 @@ import unittest from mercurial import hg from mercurial import ui -from tests import test_util +# wrapped in a try/except because of weirdness in how +# run.py works as compared to nose. +try: + import test_util +except ImportError: + from tests import test_util + from hgsubversion import wrappers
--- a/tests/run.py +++ b/tests/run.py @@ -3,34 +3,38 @@ import os import sys import unittest -import test_util -import test_binaryfiles -import test_diff -import test_externals -import test_fetch_branches -import test_fetch_command -import test_fetch_command_regexes -import test_fetch_exec -import test_fetch_mappings -import test_fetch_renames -import test_fetch_symlinks -import test_fetch_truncated -import test_pull -import test_push_command -import test_push_renames -import test_push_dirs -import test_push_eol -import test_rebuildmeta -import test_single_dir_clone -import test_svnwrap -import test_tags -import test_utility_commands -import test_urls +def tests(): + import test_util + import test_binaryfiles + import test_diff + import test_externals + import test_fetch_branches + import test_fetch_command + import test_fetch_command_regexes + import test_fetch_exec + import test_fetch_mappings + import test_fetch_renames + import test_fetch_symlinks + import test_fetch_truncated + import test_pull + import test_push_command + import test_push_renames + import test_push_dirs + import test_push_eol + import test_rebuildmeta + import test_single_dir_clone + import test_svnwrap + import test_tags + import test_utility_commands + import test_urls -sys.path.append(os.path.join(os.path.dirname(__file__), 'comprehensive')) + sys.path.append(os.path.dirname(__file__)) + sys.path.append(os.path.join(os.path.dirname(__file__), 'comprehensive')) -import test_stupid_pull -import test_verify + import test_stupid_pull + import test_verify + + return locals() def comprehensive(mod): dir = os.path.basename(os.path.dirname(mod.__file__)) @@ -58,8 +62,7 @@ if __name__ == '__main__': # silence output when running outside nose sys.stdout = os.tmpfile() - all = globals() - all = dict((k, v) for (k, v) in all.iteritems() if k.startswith('test_')) + all = tests() del all['test_util'] args = [i.split('.py')[0].replace('-', '_') for i in args]