Remove unit test class from speed tests

This commit is contained in:
Dave Halter
2017-12-13 19:22:45 +01:00
parent e03afc60ef
commit 94e2e92888

View File

@@ -6,10 +6,10 @@ should.
import time
import functools
from .helpers import TestCase, cwd_at
from .helpers import cwd_at
import jedi
class TestSpeed(TestCase):
def _check_speed(time_per_run, number=4, run_warm=True):
""" Speed checks should typically be very tolerant. Some machines are
faster than others, but the tests should still pass. These tests are
@@ -17,33 +17,36 @@ class TestSpeed(TestCase):
reintroduced to Jedi."""
def decorated(func):
@functools.wraps(func)
def wrapper(self):
def wrapper():
if run_warm:
func(self)
func()
first = time.time()
for i in range(number):
func(self)
func()
single_time = (time.time() - first) / number
message = 'speed issue %s, %s' % (func, single_time)
assert single_time < time_per_run, message
return wrapper
return decorated
@_check_speed(0.2)
def test_os_path_join(self):
def test_os_path_join():
s = "from posixpath import join; join('', '')."
assert len(jedi.Script(s).completions()) > 10 # is a str completion
@_check_speed(0.15)
def test_scipy_speed(self):
def test_scipy_speed():
s = 'import scipy.weave; scipy.weave.inline('
script = jedi.Script(s, 1, len(s), '')
script.call_signatures()
#print(jedi.imports.imports_processed)
@_check_speed(0.8)
@cwd_at('test')
def test_precedence_slowdown(self):
def test_precedence_slowdown():
"""
Precedence calculation can slow down things significantly in edge
cases. Having strange recursion structures increases the problem.
@@ -52,8 +55,9 @@ class TestSpeed(TestCase):
line = len(f.read().splitlines())
assert jedi.Script(line=line, path='speed/precedence.py').goto_definitions()
@_check_speed(0.1)
def test_no_repr_computation(self):
def test_no_repr_computation():
"""
For Interpreter completion aquisition of sourcefile can trigger
unwanted computation of repr(). Exemple : big pandas data.