forked from VimPlug/jedi
Refactor django path support
This commit is contained in:
@@ -13,7 +13,7 @@ else:
|
||||
TestCase = unittest.TestCase
|
||||
|
||||
import os
|
||||
from os.path import abspath, dirname
|
||||
from os.path import abspath, dirname, join
|
||||
import functools
|
||||
|
||||
test_dir = dirname(abspath(__file__))
|
||||
@@ -21,6 +21,11 @@ root_dir = dirname(test_dir)
|
||||
|
||||
sample_int = 1 # This is used in completion/imports.py
|
||||
|
||||
|
||||
def get_example_dir(name):
|
||||
return join(test_dir, 'examples', name)
|
||||
|
||||
|
||||
def cwd_at(path):
|
||||
"""
|
||||
Decorator to run function at `path`.
|
||||
|
||||
15
test/test_api/test_project.py
Normal file
15
test/test_api/test_project.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import os
|
||||
|
||||
from ..helpers import get_example_dir
|
||||
|
||||
|
||||
def test_django_default_project(Script):
|
||||
dir = get_example_dir('django')
|
||||
|
||||
script = Script(
|
||||
"from app import models\nmodels.SomeMo",
|
||||
path=os.path.join(dir, 'models/x.py')
|
||||
)
|
||||
c, = script.completions()
|
||||
assert c.name == "SomeModel"
|
||||
assert script._project._django is True
|
||||
Reference in New Issue
Block a user