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