diff --git a/test/refactor.py b/test/refactor.py index c6de4e3a..91e01ac9 100755 --- a/test/refactor.py +++ b/test/refactor.py @@ -101,10 +101,11 @@ def test_dir(refactoring_test_dir): base.summary.append(s) -refactoring_test_dir = '../test/refactor' -test_files = base.get_test_list() -test_dir(refactoring_test_dir) +if __name__ == '__main__': + refactoring_test_dir = '../test/refactor' + test_files = base.get_test_list() + test_dir(refactoring_test_dir) -base.print_summary() + base.print_summary() -sys.exit(1 if base.tests_fail else 0) + sys.exit(1 if base.tests_fail else 0) diff --git a/test/run.py b/test/run.py index 657dd0e6..7bbc4b03 100755 --- a/test/run.py +++ b/test/run.py @@ -10,9 +10,9 @@ tests. So basically there are different kind of tests: -- complete / definitions: ``#? `` -- goto: ``#! `` -- related names: ``#< `` +- complete / definitions ``#?`` +- goto: ``#!`` +- related names: ``#<`` Auto-Completion +++++++++++++++ @@ -268,32 +268,34 @@ def test_dir(completion_test_dir, thirdparty=False): print(s) base.summary.append(s) -try: - i = sys.argv.index('--thirdparty') - thirdparty = True - sys.argv = sys.argv[:i] + sys.argv[i + 1:] -except ValueError: - thirdparty = False -test_files = base.get_test_list() +if __name__ == '__main__': + try: + i = sys.argv.index('--thirdparty') + thirdparty = True + sys.argv = sys.argv[:i] + sys.argv[i + 1:] + except ValueError: + thirdparty = False -# completion tests: -completion_test_dir = '../test/completion' + test_files = base.get_test_list() -# execute tests -test_dir(completion_test_dir) -if test_files or thirdparty: - completion_test_dir += '/thirdparty' - test_dir(completion_test_dir, thirdparty=True) + # completion tests: + completion_test_dir = '../test/completion' -base.print_summary() -#from guppy import hpy -#hpy() -#print hpy().heap() + # execute tests + test_dir(completion_test_dir) + if test_files or thirdparty: + completion_test_dir += '/thirdparty' + test_dir(completion_test_dir, thirdparty=True) -exit_code = 1 if base.tests_fail else 0 -if sys.hexversion < 0x02060000 and base.tests_fail <= 9: - # Python 2.5 has major incompabillities (e.g. no property.setter), - # therefore it is not possible to pass all tests. - exit_code = 0 -sys.exit(exit_code) + base.print_summary() + #from guppy import hpy + #hpy() + #print hpy().heap() + + exit_code = 1 if base.tests_fail else 0 + if sys.hexversion < 0x02060000 and base.tests_fail <= 9: + # Python 2.5 has major incompabillities (e.g. no property.setter), + # therefore it is not possible to pass all tests. + exit_code = 0 + sys.exit(exit_code)