forked from VimPlug/jedi
Some refactoring to finally get tests working with py27 and 3 environments
This commit is contained in:
@@ -30,9 +30,9 @@ def cwd_at(path):
|
|||||||
"""
|
"""
|
||||||
def decorator(func):
|
def decorator(func):
|
||||||
@functools.wraps(func)
|
@functools.wraps(func)
|
||||||
def wrapper(Script, **kwds):
|
def wrapper(Script, **kwargs):
|
||||||
with set_cwd(path):
|
with set_cwd(path):
|
||||||
return func(Script, **kwds)
|
return func(Script, **kwargs)
|
||||||
return wrapper
|
return wrapper
|
||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ def _check_speed(time_per_run, number=4, run_warm=True):
|
|||||||
reintroduced to Jedi."""
|
reintroduced to Jedi."""
|
||||||
def decorated(func):
|
def decorated(func):
|
||||||
@functools.wraps(func)
|
@functools.wraps(func)
|
||||||
def wrapper(**kwargs):
|
def wrapper(Script, **kwargs):
|
||||||
if run_warm:
|
if run_warm:
|
||||||
func(**kwargs)
|
func(Script=Script, **kwargs)
|
||||||
first = time.time()
|
first = time.time()
|
||||||
for i in range(number):
|
for i in range(number):
|
||||||
func(**kwargs)
|
func(Script=Script, **kwargs)
|
||||||
single_time = (time.time() - first) / number
|
single_time = (time.time() - first) / number
|
||||||
message = 'speed issue %s, %s' % (func, single_time)
|
message = 'speed issue %s, %s' % (func, single_time)
|
||||||
assert single_time < time_per_run, message
|
assert single_time < time_per_run, message
|
||||||
@@ -57,7 +57,7 @@ def test_precedence_slowdown(Script):
|
|||||||
|
|
||||||
|
|
||||||
@_check_speed(0.1)
|
@_check_speed(0.1)
|
||||||
def test_no_repr_computation():
|
def test_no_repr_computation(Script):
|
||||||
"""
|
"""
|
||||||
For Interpreter completion aquisition of sourcefile can trigger
|
For Interpreter completion aquisition of sourcefile can trigger
|
||||||
unwanted computation of repr(). Exemple : big pandas data.
|
unwanted computation of repr(). Exemple : big pandas data.
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class TestSetupReadline(unittest.TestCase):
|
|||||||
assert len(set(self.completions(s)).symmetric_difference(goal)) < 20
|
assert len(set(self.completions(s)).symmetric_difference(goal)) < 20
|
||||||
|
|
||||||
@cwd_at('test')
|
@cwd_at('test')
|
||||||
def test_local_import(self, _):
|
def test_local_import(self):
|
||||||
s = 'import test_utils'
|
s = 'import test_utils'
|
||||||
assert self.completions(s) == [s]
|
assert self.completions(s) == [s]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user