mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 23:34:45 +08:00
added thirdparty testing (test/completion/thirdparty/) and fixed an AttributeError
This commit is contained in:
@@ -207,7 +207,7 @@ class Instance(Executable):
|
|||||||
return res
|
return res
|
||||||
|
|
||||||
def __getattr__(self, name):
|
def __getattr__(self, name):
|
||||||
if name not in ['line_nr', 'indent', 'name']:
|
if name not in ['line_nr', 'indent', 'name', 'get_imports']:
|
||||||
raise AttributeError("Don't touch this (%s)!" % name)
|
raise AttributeError("Don't touch this (%s)!" % name)
|
||||||
return getattr(self.base, name)
|
return getattr(self.base, name)
|
||||||
|
|
||||||
|
|||||||
9
test/completion/thirdparty/django.py
vendored
Normal file
9
test/completion/thirdparty/django.py
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import django
|
||||||
|
|
||||||
|
#? ['get_version']
|
||||||
|
django.get_version
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
#? ['configured']
|
||||||
|
settings.configured
|
||||||
32
test/run.py
32
test/run.py
@@ -121,17 +121,27 @@ def run_test(source):
|
|||||||
completion_test_dir = 'test/completion'
|
completion_test_dir = 'test/completion'
|
||||||
summary = []
|
summary = []
|
||||||
tests_pass = True
|
tests_pass = True
|
||||||
for f_name in os.listdir(completion_test_dir):
|
def test_dir(completion_test_dir, third_party=False):
|
||||||
if len(sys.argv) == 1 or [a for a in sys.argv[1:] if a in f_name]:
|
global tests_pass
|
||||||
if f_name.endswith(".py"):
|
for f_name in os.listdir(completion_test_dir):
|
||||||
path = os.path.join(completion_test_dir, f_name)
|
if len(sys.argv) == 1 or [a for a in sys.argv[1:] if a in f_name]:
|
||||||
f = open(path)
|
if f_name.endswith(".py"):
|
||||||
num_tests, fails = run_test(f.read())
|
if third_party:
|
||||||
s = 'run %s tests with %s fails (%s)' % (num_tests, fails, f_name)
|
try:
|
||||||
if fails:
|
__import__(f_name.replace('.py', ''))
|
||||||
tests_pass = False
|
except ImportError:
|
||||||
print(s)
|
summary.append('Thirdparty-Library %s not found.' % f_name)
|
||||||
summary.append(s)
|
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)
|
||||||
|
if fails:
|
||||||
|
tests_pass = False
|
||||||
|
print(s)
|
||||||
|
summary.append(s)
|
||||||
|
|
||||||
|
test_dir(completion_test_dir)
|
||||||
|
test_dir(completion_test_dir + '/thirdparty', third_party=True)
|
||||||
|
|
||||||
print('\nSummary:')
|
print('\nSummary:')
|
||||||
for s in summary:
|
for s in summary:
|
||||||
|
|||||||
Reference in New Issue
Block a user