mirror of
https://github.com/davidhalter/jedi.git
synced 2026-05-19 14:59:41 +08:00
Remove old utility functions in test.base
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
import time
|
|
||||||
import sys
|
import sys
|
||||||
if sys.hexversion < 0x02070000:
|
if sys.hexversion < 0x02070000:
|
||||||
import unittest2 as unittest
|
import unittest2 as unittest
|
||||||
@@ -15,45 +14,8 @@ sys.path.insert(0, root_dir)
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import jedi
|
import jedi
|
||||||
from jedi import debug
|
|
||||||
from jedi._compatibility import is_py25
|
from jedi._compatibility import is_py25
|
||||||
|
|
||||||
test_sum = 0
|
|
||||||
t_start = time.time()
|
|
||||||
# Sorry I didn't use argparse here. It's because argparse is not in the
|
|
||||||
# stdlib in 2.5.
|
|
||||||
args = sys.argv[1:]
|
|
||||||
|
|
||||||
print_debug = False
|
|
||||||
try:
|
|
||||||
i = args.index('--debug')
|
|
||||||
args = args[:i] + args[i + 1:]
|
|
||||||
except ValueError:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
print_debug = True
|
|
||||||
jedi.set_debug_function(debug.print_to_stdout)
|
|
||||||
|
|
||||||
sys.argv = sys.argv[:1] + args
|
|
||||||
|
|
||||||
summary = []
|
|
||||||
tests_fail = 0
|
|
||||||
|
|
||||||
|
|
||||||
def get_test_list():
|
|
||||||
# get test list, that should be executed
|
|
||||||
test_files = {}
|
|
||||||
last = None
|
|
||||||
for arg in sys.argv[1:]:
|
|
||||||
if arg.isdigit():
|
|
||||||
if last is None:
|
|
||||||
continue
|
|
||||||
test_files[last].append(int(arg))
|
|
||||||
else:
|
|
||||||
test_files[arg] = []
|
|
||||||
last = arg
|
|
||||||
return test_files
|
|
||||||
|
|
||||||
|
|
||||||
class TestBase(unittest.TestCase):
|
class TestBase(unittest.TestCase):
|
||||||
def get_script(self, src, pos, path=None):
|
def get_script(self, src, pos, path=None):
|
||||||
@@ -79,13 +41,6 @@ class TestBase(unittest.TestCase):
|
|||||||
return script.function_definition()
|
return script.function_definition()
|
||||||
|
|
||||||
|
|
||||||
def print_summary():
|
|
||||||
print('\nSummary: (%s fails of %s tests) in %.3fs' % \
|
|
||||||
(tests_fail, test_sum, time.time() - t_start))
|
|
||||||
for s in summary:
|
|
||||||
print(s)
|
|
||||||
|
|
||||||
|
|
||||||
def cwd_at(path):
|
def cwd_at(path):
|
||||||
"""
|
"""
|
||||||
Decorator to run function at `path`.
|
Decorator to run function at `path`.
|
||||||
|
|||||||
Reference in New Issue
Block a user