This commit is contained in:
David Halter
2012-07-13 15:55:18 +02:00
parent 19579cf263
commit 1e5377958b
2 changed files with 16 additions and 10 deletions

View File

@@ -17,6 +17,7 @@ if only_line is not None:
debug.ignored_modules = ['parsing', 'builtin']
#functions.set_debug_function(functions.debug.print_to_stdout)
def run_completion_test(correct, source, line_nr, line):
"""
Runs tests for completions.
@@ -77,6 +78,7 @@ def run_definition_test(correct, source, line_nr, line, correct_start):
return 1
return 0
def run_test(source):
"""
This is the completion test for some cases. The tests are not unit test
@@ -118,10 +120,7 @@ def run_test(source):
correct = None
return tests, fails
# completion tests:
completion_test_dir = 'test/completion'
summary = []
tests_pass = True
def test_dir(completion_test_dir, third_party=False):
global tests_pass
for f_name in os.listdir(completion_test_dir):
@@ -134,17 +133,24 @@ def test_dir(completion_test_dir, third_party=False):
try:
__import__(f_name.replace('.py', ''))
except ImportError:
summary.append('Thirdparty-Library %s not found.' % f_name)
summary.append('Thirdparty-Library %s not found.' %
f_name)
continue
path = os.path.join(completion_test_dir, f_name)
f = open(path)
num_tests, fails = run_test(f.read())
s = 'run %s tests with %s fails (%s)' % (num_tests, fails, f_name)
s = 'run %s tests with %s fails (%s)' % (num_tests, fails,
f_name)
if fails:
tests_pass = False
print(s)
summary.append(s)
# completion tests:
completion_test_dir = 'test/completion'
summary = []
tests_pass = True
test_dir(completion_test_dir)
test_dir(completion_test_dir + '/thirdparty', third_party=True)