1
0
forked from VimPlug/jedi

switched to __name__ == '__main__' checks for tests

This commit is contained in:
David Halter
2013-03-01 00:07:36 +04:30
parent 1834ef51b1
commit 855d683d9a
2 changed files with 35 additions and 32 deletions

View File

@@ -101,10 +101,11 @@ def test_dir(refactoring_test_dir):
base.summary.append(s) base.summary.append(s)
refactoring_test_dir = '../test/refactor' if __name__ == '__main__':
test_files = base.get_test_list() refactoring_test_dir = '../test/refactor'
test_dir(refactoring_test_dir) 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)

View File

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