1
0
forked from VimPlug/jedi

Refactor django path support

This commit is contained in:
Dave Halter
2018-01-24 19:13:05 +01:00
parent e4559bef51
commit 68f840de60
7 changed files with 70 additions and 36 deletions

View File

@@ -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`.

View 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