mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fixes after Fabio's review in pull request
This commit is contained in:
@@ -6,7 +6,7 @@ from _pydev_bundle._pydev_calltip_util import get_description
|
||||
from _pydev_imps._pydev_saved_modules import thread
|
||||
from _pydevd_bundle import pydevd_vars
|
||||
from _pydevd_bundle import pydevd_xml
|
||||
from _pydevd_bundle.pydevd_constants import IS_JYTHON
|
||||
from _pydevd_bundle.pydevd_constants import IS_JYTHON, dict_iter_items
|
||||
from _pydevd_bundle.pydevd_utils import to_string
|
||||
|
||||
|
||||
@@ -499,7 +499,7 @@ class BaseInterpreterInterface:
|
||||
debugger_options = {}
|
||||
env_key = "PYDEVD_EXTRA_ENVS"
|
||||
if env_key in debugger_options:
|
||||
for (env_name, value) in debugger_options[env_key].items():
|
||||
for (env_name, value) in dict_iter_items(debugger_options[env_key]):
|
||||
os.environ[env_name] = value
|
||||
del debugger_options[env_key]
|
||||
def do_connect_to_debugger():
|
||||
|
||||
@@ -80,7 +80,7 @@ class DebugConsole(InteractiveConsole, BaseInterpreterInterface):
|
||||
"""
|
||||
|
||||
overrides(BaseInterpreterInterface.create_std_in)
|
||||
def create_std_in(self):
|
||||
def create_std_in(self, *args, **kwargs):
|
||||
try:
|
||||
if not self.__buffer_output:
|
||||
return sys.stdin
|
||||
|
||||
@@ -52,7 +52,6 @@ if IS_JYTHON:
|
||||
IS_JYTH_LESS25 = True
|
||||
|
||||
CYTHON_SUPPORTED = False
|
||||
GC_SUPPORTED = False
|
||||
|
||||
try:
|
||||
import platform
|
||||
@@ -61,7 +60,6 @@ except:
|
||||
pass
|
||||
else:
|
||||
if python_implementation == 'CPython':
|
||||
GC_SUPPORTED = True
|
||||
# Only available for CPython!
|
||||
if (
|
||||
(sys.version_info[0] == 2 and sys.version_info[1] >= 7)
|
||||
|
||||
@@ -377,7 +377,11 @@ def process_net_command(py_db, cmd_id, seq, text):
|
||||
elif cmd_id == CMD_EVALUATE_EXPRESSION or cmd_id == CMD_EXEC_EXPRESSION:
|
||||
#command to evaluate the given expression
|
||||
#text is: thread\tstackframe\tLOCAL\texpression
|
||||
thread_id, frame_id, scope, expression, trim, temp_name = text.split('\t', 5)
|
||||
temp_name = ""
|
||||
try:
|
||||
thread_id, frame_id, scope, expression, trim, temp_name = text.split('\t', 5)
|
||||
except ValueError:
|
||||
thread_id, frame_id, scope, expression, trim = text.split('\t', 4)
|
||||
int_cmd = InternalEvaluateExpression(seq, thread_id, frame_id, expression,
|
||||
cmd_id == CMD_EXEC_EXPRESSION, int(trim) == 1, temp_name)
|
||||
py_db.post_internal_command(int_cmd, thread_id)
|
||||
|
||||
@@ -96,6 +96,7 @@ class DefaultResolver:
|
||||
'''
|
||||
DefaultResolver is the class that'll actually resolve how to show some variable.
|
||||
'''
|
||||
use_value_repr_instead_of_str = False
|
||||
|
||||
def resolve(self, var, attribute):
|
||||
return getattr(var, attribute)
|
||||
@@ -219,6 +220,7 @@ class DefaultResolver:
|
||||
# DictResolver
|
||||
#=======================================================================================================================
|
||||
class DictResolver:
|
||||
use_value_repr_instead_of_str = False
|
||||
|
||||
def resolve(self, dict, key):
|
||||
if key in ('__len__', TOO_LARGE_ATTR):
|
||||
@@ -274,6 +276,7 @@ class DictResolver:
|
||||
# TupleResolver
|
||||
#=======================================================================================================================
|
||||
class TupleResolver: #to enumerate tuples and lists
|
||||
use_value_repr_instead_of_str = False
|
||||
|
||||
def resolve(self, var, attribute):
|
||||
'''
|
||||
@@ -317,6 +320,7 @@ class SetResolver:
|
||||
'''
|
||||
Resolves a set as dict id(object)->object
|
||||
'''
|
||||
use_value_repr_instead_of_str = False
|
||||
|
||||
def resolve(self, var, attribute):
|
||||
if attribute in ('__len__', TOO_LARGE_ATTR):
|
||||
@@ -356,6 +360,7 @@ class SetResolver:
|
||||
# InstanceResolver
|
||||
#=======================================================================================================================
|
||||
class InstanceResolver:
|
||||
use_value_repr_instead_of_str = False
|
||||
|
||||
def resolve(self, var, attribute):
|
||||
field = var.__class__.getDeclaredField(attribute)
|
||||
@@ -384,6 +389,7 @@ class JyArrayResolver:
|
||||
'''
|
||||
This resolves a regular Object[] array from java
|
||||
'''
|
||||
use_value_repr_instead_of_str = False
|
||||
|
||||
def resolve(self, var, attribute):
|
||||
if attribute == '__len__':
|
||||
@@ -407,6 +413,7 @@ class NdArrayResolver:
|
||||
'''
|
||||
This resolves a numpy ndarray returning some metadata about the NDArray
|
||||
'''
|
||||
use_value_repr_instead_of_str = False
|
||||
|
||||
def is_numeric(self, obj):
|
||||
if not hasattr(obj, 'dtype'):
|
||||
@@ -472,6 +479,7 @@ class NdArrayItemsContainer: pass
|
||||
# MultiValueDictResolver
|
||||
#=======================================================================================================================
|
||||
class MultiValueDictResolver(DictResolver):
|
||||
use_value_repr_instead_of_str = False
|
||||
|
||||
def resolve(self, dict, key):
|
||||
if key in ('__len__', TOO_LARGE_ATTR):
|
||||
@@ -494,6 +502,7 @@ class MultiValueDictResolver(DictResolver):
|
||||
#=======================================================================================================================
|
||||
class DjangoFormResolver(DefaultResolver):
|
||||
has_errors_attr = False
|
||||
use_value_repr_instead_of_str = True
|
||||
|
||||
def get_names(self, var):
|
||||
names = dir(var)
|
||||
@@ -521,6 +530,7 @@ class DjangoFormResolver(DefaultResolver):
|
||||
# DequeResolver
|
||||
#=======================================================================================================================
|
||||
class DequeResolver(TupleResolver):
|
||||
use_value_repr_instead_of_str = False
|
||||
def get_dictionary(self, var):
|
||||
d = TupleResolver.get_dictionary(self, var)
|
||||
d['maxlen'] = getattr(var, 'maxlen', None)
|
||||
@@ -534,6 +544,7 @@ class FrameResolver:
|
||||
'''
|
||||
This resolves a frame.
|
||||
'''
|
||||
use_value_repr_instead_of_str = False
|
||||
|
||||
def resolve(self, obj, attribute):
|
||||
if attribute == '__internals__':
|
||||
|
||||
@@ -8,13 +8,10 @@ except:
|
||||
from urllib.parse import quote # @UnresolvedImport
|
||||
|
||||
import inspect
|
||||
from _pydevd_bundle.pydevd_constants import IS_PY3K, GC_SUPPORTED
|
||||
from _pydevd_bundle.pydevd_constants import IS_PY3K
|
||||
import sys
|
||||
from _pydev_bundle import pydev_log
|
||||
try:
|
||||
import gc
|
||||
except ImportError:
|
||||
GC_SUPPORTED = False
|
||||
|
||||
|
||||
def save_main_module(file, module_name):
|
||||
# patch provided by: Scott Schlesier - when script is run, it does not
|
||||
@@ -127,51 +124,26 @@ else:
|
||||
|
||||
def get_clsname_for_code(code, frame):
|
||||
clsname = None
|
||||
if GC_SUPPORTED:
|
||||
## use of gc.get_referrers() was suggested by Michael Hudson
|
||||
# all functions which refer to this code object
|
||||
funcs = [f for f in gc.get_referrers(code)
|
||||
if inspect.isfunction(f)]
|
||||
# require len(func) == 1 to avoid ambiguity caused by calls to
|
||||
# new.function(): "In the face of ambiguity, refuse the
|
||||
# temptation to guess."
|
||||
if len(funcs) == 1:
|
||||
dicts = [d for d in gc.get_referrers(funcs[0])
|
||||
if isinstance(d, dict)]
|
||||
if len(dicts) == 1:
|
||||
classes = [c for c in gc.get_referrers(dicts[0])
|
||||
if hasattr(c, "__bases__") or inspect.isclass(c)]
|
||||
elif len(dicts) > 1: #new-style classes
|
||||
classes = [c for c in gc.get_referrers(dicts[1])
|
||||
if hasattr(c, "__bases__") or inspect.isclass(c)]
|
||||
else:
|
||||
classes = []
|
||||
|
||||
if len(classes) == 1:
|
||||
# ditto for new.classobj()
|
||||
clsname = classes[0].__name__
|
||||
|
||||
if clsname is None:
|
||||
# If gc is not supported we are checking the first argument of the function
|
||||
if len(code.co_varnames) > 0:
|
||||
# We are checking the first argument of the function
|
||||
# (`self` or `cls` for methods).
|
||||
func_name = code.co_name
|
||||
if len(code.co_varnames) > 0:
|
||||
first_arg_name = code.co_varnames[0]
|
||||
if first_arg_name in frame.f_locals:
|
||||
first_arg_obj = frame.f_locals[first_arg_name]
|
||||
if inspect.isclass(first_arg_obj): # class method
|
||||
first_arg_class = first_arg_obj
|
||||
else: # instance method
|
||||
first_arg_class = first_arg_obj.__class__
|
||||
if hasattr(first_arg_class, func_name):
|
||||
method = getattr(first_arg_class, func_name)
|
||||
func_code = None
|
||||
if hasattr(method, 'func_code'): # Python2
|
||||
func_code = method.func_code
|
||||
elif hasattr(method, '__code__'): # Python3
|
||||
func_code = method.__code__
|
||||
if func_code and func_code == code:
|
||||
clsname = first_arg_class.__name__
|
||||
first_arg_name = code.co_varnames[0]
|
||||
if first_arg_name in frame.f_locals:
|
||||
first_arg_obj = frame.f_locals[first_arg_name]
|
||||
if inspect.isclass(first_arg_obj): # class method
|
||||
first_arg_class = first_arg_obj
|
||||
else: # instance method
|
||||
first_arg_class = first_arg_obj.__class__
|
||||
func_name = code.co_name
|
||||
if hasattr(first_arg_class, func_name):
|
||||
method = getattr(first_arg_class, func_name)
|
||||
func_code = None
|
||||
if hasattr(method, 'func_code'): # Python2
|
||||
func_code = method.func_code
|
||||
elif hasattr(method, '__code__'): # Python3
|
||||
func_code = method.__code__
|
||||
if func_code and func_code == code:
|
||||
clsname = first_arg_class.__name__
|
||||
return clsname
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
resolution/conversion to XML.
|
||||
"""
|
||||
import pickle
|
||||
from _pydevd_bundle.pydevd_constants import dict_contains, get_frame, get_thread_id
|
||||
from _pydevd_bundle.pydevd_constants import dict_contains, get_frame, get_thread_id, xrange
|
||||
|
||||
from _pydevd_bundle.pydevd_custom_frames import get_custom_frame
|
||||
from _pydevd_bundle.pydevd_xml import ExceptionOnEvaluate, get_type, var_to_xml
|
||||
@@ -20,6 +20,7 @@ from _pydevd_bundle import pydevd_save_locals
|
||||
from _pydev_bundle.pydev_imports import Exec, quote, execfile
|
||||
from _pydevd_bundle.pydevd_utils import to_string
|
||||
|
||||
SENTINEL_VALUE = []
|
||||
|
||||
# -------------------------------------------------------------------------- defining true and false for earlier versions
|
||||
|
||||
@@ -368,7 +369,7 @@ def evaluate_expression(thread_id, frame_id, expression, doExec):
|
||||
del frame
|
||||
|
||||
|
||||
def change_attr_expression(thread_id, frame_id, attr, expression, dbg, value=None):
|
||||
def change_attr_expression(thread_id, frame_id, attr, expression, dbg, value=SENTINEL_VALUE):
|
||||
'''Changes some attribute in a given frame.
|
||||
'''
|
||||
frame = find_frame(thread_id, frame_id)
|
||||
@@ -378,7 +379,7 @@ def change_attr_expression(thread_id, frame_id, attr, expression, dbg, value=Non
|
||||
try:
|
||||
expression = expression.replace('@LINE@', '\n')
|
||||
|
||||
if dbg.plugin and not value:
|
||||
if dbg.plugin and value is not SENTINEL_VALUE:
|
||||
result = dbg.plugin.change_variable(frame, attr, expression)
|
||||
if result:
|
||||
return result
|
||||
@@ -386,20 +387,20 @@ def change_attr_expression(thread_id, frame_id, attr, expression, dbg, value=Non
|
||||
if attr[:7] == "Globals":
|
||||
attr = attr[8:]
|
||||
if attr in frame.f_globals:
|
||||
if value is None:
|
||||
if value is SENTINEL_VALUE:
|
||||
value = eval(expression, frame.f_globals, frame.f_locals)
|
||||
frame.f_globals[attr] = value
|
||||
return frame.f_globals[attr]
|
||||
else:
|
||||
if pydevd_save_locals.is_save_locals_available():
|
||||
if value is None:
|
||||
if value is SENTINEL_VALUE:
|
||||
value = eval(expression, frame.f_globals, frame.f_locals)
|
||||
frame.f_locals[attr] = value
|
||||
pydevd_save_locals.save_locals(frame)
|
||||
return frame.f_locals[attr]
|
||||
|
||||
# default way (only works for changing it in the topmost frame)
|
||||
if value is None:
|
||||
if value is SENTINEL_VALUE:
|
||||
value = eval(expression, frame.f_globals, frame.f_locals)
|
||||
result = value
|
||||
Exec('%s=%s' % (attr, expression), frame.f_globals, frame.f_locals)
|
||||
@@ -539,6 +540,15 @@ def array_to_meta_xml(array, name, format):
|
||||
return array, xml, rows, cols, format
|
||||
|
||||
|
||||
def array_default_format(type):
|
||||
if type == 'f':
|
||||
return '.5f'
|
||||
elif type == 'i' or type == 'u':
|
||||
return 'd'
|
||||
else:
|
||||
return 's'
|
||||
|
||||
|
||||
def dataframe_to_xml(df, name, roffset, coffset, rows, cols, format):
|
||||
"""
|
||||
:type df: pandas.core.frame.DataFrame
|
||||
@@ -581,13 +591,6 @@ def dataframe_to_xml(df, name, roffset, coffset, rows, cols, format):
|
||||
df = df.iloc[roffset: roffset + rows, coffset: coffset + cols]
|
||||
rows, cols = df.shape
|
||||
|
||||
def default_format(type):
|
||||
if type == 'f':
|
||||
return '.5f'
|
||||
elif type == 'i' or type == 'u':
|
||||
return 'd'
|
||||
else:
|
||||
return 's'
|
||||
|
||||
xml += "<headerdata rows=\"%s\" cols=\"%s\">\n" % (rows, cols)
|
||||
format = format.replace('%', '')
|
||||
@@ -597,7 +600,7 @@ def dataframe_to_xml(df, name, roffset, coffset, rows, cols, format):
|
||||
|
||||
for col in range(cols):
|
||||
dtype = df.dtypes.iloc[col].kind
|
||||
fmt = format if (dtype == 'f' and format) else default_format(dtype)
|
||||
fmt = format if (dtype == 'f' and format) else array_default_format(dtype)
|
||||
col_formats.append('%' + fmt)
|
||||
bounds = col_bounds[col]
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@ from _pydev_bundle import pydev_log
|
||||
import traceback
|
||||
from _pydevd_bundle import pydevd_resolver
|
||||
import sys
|
||||
from _pydevd_bundle.pydevd_constants import dict_keys, IS_PY3K, MAXIMUM_VARIABLE_REPRESENTATION_SIZE, RETURN_VALUES_DICT
|
||||
from _pydevd_bundle.pydevd_constants import dict_contains, dict_iter_items, dict_keys, IS_PY3K, \
|
||||
MAXIMUM_VARIABLE_REPRESENTATION_SIZE, RETURN_VALUES_DICT
|
||||
|
||||
from _pydev_bundle.pydev_imports import quote
|
||||
|
||||
@@ -156,18 +157,8 @@ def get_type(o):
|
||||
|
||||
def return_values_from_dict_to_xml(return_dict):
|
||||
res = ""
|
||||
for name in dict_keys(return_dict):
|
||||
val = return_dict[name]
|
||||
res += var_to_xml(val, name, return_value=True)
|
||||
return res
|
||||
|
||||
|
||||
def ipython_hidden_values_to_xml(key, val, hidden_ns):
|
||||
res = ""
|
||||
if key in hidden_ns.keys():
|
||||
res += var_to_xml(val, str(key), ipython_hidden=True)
|
||||
else:
|
||||
res += var_to_xml(val, str(key))
|
||||
for name, val in dict_iter_items(return_dict):
|
||||
res += var_to_xml(val, name, additionalInXml=' isRetVal="True"')
|
||||
return res
|
||||
|
||||
|
||||
@@ -189,8 +180,8 @@ def frame_vars_to_xml(frame_f_locals, hidden_ns=None):
|
||||
if k == RETURN_VALUES_DICT:
|
||||
xml += return_values_from_dict_to_xml(v)
|
||||
else:
|
||||
if hidden_ns is not None:
|
||||
xml += ipython_hidden_values_to_xml(k, v, hidden_ns)
|
||||
if hidden_ns is not None and dict_contains(hidden_ns, k):
|
||||
xml += var_to_xml(v, str(k), additionalInXml=' isIPythonHidden="True"')
|
||||
else:
|
||||
xml += var_to_xml(v, str(k))
|
||||
except Exception:
|
||||
@@ -200,9 +191,6 @@ def frame_vars_to_xml(frame_f_locals, hidden_ns=None):
|
||||
return xml
|
||||
|
||||
|
||||
def get_type_qualifier(type):
|
||||
return getattr(type, "__module__", "")
|
||||
|
||||
def var_to_xml(val, name, doTrim=True, additionalInXml='', return_value=False, ipython_hidden=False):
|
||||
""" single variable or dictionary to xml representation """
|
||||
|
||||
@@ -214,13 +202,8 @@ def var_to_xml(val, name, doTrim=True, additionalInXml='', return_value=False, i
|
||||
v = val
|
||||
|
||||
_type, typeName, resolver = get_type(v)
|
||||
type_qualifier = get_type_qualifier(_type)
|
||||
|
||||
|
||||
do_not_call_value_str = False
|
||||
if isinstance(resolver, pydevd_resolver.djangoFormResolver.__class__):
|
||||
# do not call str() of Django form objects because has side effects and breaks self.errors
|
||||
do_not_call_value_str = True
|
||||
type_qualifier = getattr(_type, "__module__", "")
|
||||
do_not_call_value_str = resolver is not None and resolver.use_value_repr_instead_of_str
|
||||
|
||||
try:
|
||||
if hasattr(v, '__class__'):
|
||||
@@ -263,20 +246,10 @@ def var_to_xml(val, name, doTrim=True, additionalInXml='', return_value=False, i
|
||||
except:
|
||||
pass
|
||||
|
||||
if return_value:
|
||||
xmlRetVal = ' isRetVal="True"'
|
||||
else:
|
||||
xmlRetVal = ''
|
||||
|
||||
if ipython_hidden:
|
||||
xmlIPythonHidden = ' isIPythonHidden="True"'
|
||||
else:
|
||||
xmlIPythonHidden = ''
|
||||
|
||||
xml = '<var name="%s" type="%s" ' % (make_valid_xml_value(name), make_valid_xml_value(typeName))
|
||||
|
||||
if type_qualifier:
|
||||
xmlQualifier = ' qualifier="%s" ' % make_valid_xml_value(type_qualifier)
|
||||
xmlQualifier = 'qualifier="%s"' % make_valid_xml_value(type_qualifier)
|
||||
else:
|
||||
xmlQualifier = ''
|
||||
|
||||
@@ -309,5 +282,5 @@ def var_to_xml(val, name, doTrim=True, additionalInXml='', return_value=False, i
|
||||
else:
|
||||
xmlCont = ''
|
||||
|
||||
return ''.join((xml, xmlQualifier, xmlValue, xmlCont, xmlRetVal, xmlIPythonHidden, additionalInXml, ' />\n'))
|
||||
return ''.join((xml, xmlQualifier, xmlValue, xmlCont, additionalInXml, ' />\n'))
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import os
|
||||
import sys
|
||||
|
||||
from _pydev_imps._pydev_saved_modules import threading
|
||||
from _pydevd_bundle.pydevd_constants import dict_iter_items
|
||||
|
||||
import traceback
|
||||
from _pydev_bundle import fix_getpass
|
||||
@@ -338,7 +339,7 @@ def start_console_server(host, port, interpreter):
|
||||
pass
|
||||
if not retry:
|
||||
raise
|
||||
# Otherwise, keep on going
|
||||
# Otherwise, keep on going
|
||||
return server
|
||||
|
||||
|
||||
@@ -361,12 +362,15 @@ def get_ipython_hidden_vars_dict():
|
||||
if IPYTHON and hasattr(__builtin__, 'interpreter'):
|
||||
pydev_interpreter = get_interpreter().interpreter
|
||||
if hasattr(pydev_interpreter, 'ipython') and hasattr(pydev_interpreter.ipython, 'user_ns_hidden'):
|
||||
try:
|
||||
user_hidden_dict = pydev_interpreter.ipython.user_ns_hidden
|
||||
except:
|
||||
user_hidden_dict = dict([(key, val) for key, val in pydev_interpreter.ipython.user_ns.items()
|
||||
if key in pydev_interpreter.ipython.user_ns_hidden])
|
||||
return dict([(key, val) for key, val in user_hidden_dict.items() if key not in useful_ipython_vars])
|
||||
user_ns_hidden = pydev_interpreter.ipython.user_ns_hidden
|
||||
if isinstance(user_ns_hidden, dict):
|
||||
# Since IPython 2 dict `user_ns_hidden` contains hidden variables and values
|
||||
user_hidden_dict = user_ns_hidden
|
||||
else:
|
||||
# In IPython 1.x `user_ns_hidden` used to be a set with names of hidden variables
|
||||
user_hidden_dict = dict([(key, val) for key, val in dict_iter_items(pydev_interpreter.ipython.user_ns)
|
||||
if key in user_ns_hidden])
|
||||
return dict([(key, val) for key, val in dict_iter_items(user_hidden_dict) if key not in useful_ipython_vars])
|
||||
return None
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
Note that it's a python script but it'll spawn a process to run as jython, ironpython and as python.
|
||||
'''
|
||||
from tests_pydevd_python.debugger_unittest import get_free_port
|
||||
from tests_python.debugger_unittest import get_free_port
|
||||
import threading
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import unittest
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
from tests_pydevd_python import debugger_unittest
|
||||
from tests_python import debugger_unittest
|
||||
|
||||
TEST_DJANGO = False
|
||||
if sys.version_info[:2] == (2, 7):
|
||||
@@ -33,6 +33,16 @@ if sys.version_info[:2] == (2, 7):
|
||||
except:
|
||||
pass
|
||||
|
||||
IS_PY2 = False
|
||||
if sys.version_info[0] == 2:
|
||||
IS_PY2 = True
|
||||
|
||||
if IS_PY2:
|
||||
builtin_qualifier = "__builtin__"
|
||||
else:
|
||||
builtin_qualifier = "builtins"
|
||||
|
||||
|
||||
TEST_CYTHON = os.getenv('PYDEVD_USE_CYTHON', None) == 'YES'
|
||||
|
||||
#=======================================================================================================================
|
||||
@@ -52,7 +62,7 @@ class WriterThreadCaseSetNextStatement(debugger_unittest.AbstractWriterThread):
|
||||
assert line == 6, 'Expected return to be in line 6, was: %s' % line
|
||||
|
||||
self.write_evaluate_expression('%s\t%s\t%s' % (thread_id, frame_id, 'LOCAL'), 'a')
|
||||
self.wait_for_evaluation('<var name="a" type="int" value="int: 2"')
|
||||
self.wait_for_evaluation('<var name="a" type="int" qualifier="{}" value="int: 2"'.format(builtin_qualifier))
|
||||
self.write_set_next_statement(thread_id, 2, 'method')
|
||||
thread_id, frame_id, line = self.wait_for_breakpoint_hit('111', True)
|
||||
assert line == 2, 'Expected return to be in line 2, was: %s' % line
|
||||
@@ -61,7 +71,7 @@ class WriterThreadCaseSetNextStatement(debugger_unittest.AbstractWriterThread):
|
||||
thread_id, frame_id, line = self.wait_for_breakpoint_hit('108', True)
|
||||
|
||||
self.write_evaluate_expression('%s\t%s\t%s' % (thread_id, frame_id, 'LOCAL'), 'a')
|
||||
self.wait_for_evaluation('<var name="a" type="int" value="int: 1"')
|
||||
self.wait_for_evaluation('<var name="a" type="int" qualifier="{}" value="int: 1"'.format(builtin_qualifier))
|
||||
|
||||
self.write_remove_breakpoint(breakpoint_id)
|
||||
self.write_run_thread(thread_id)
|
||||
@@ -160,7 +170,7 @@ class WriterThreadCase19(debugger_unittest.AbstractWriterThread):
|
||||
assert line == 8, 'Expected return to be in line 8, was: %s' % line
|
||||
|
||||
self.write_evaluate_expression('%s\t%s\t%s' % (thread_id, frame_id, 'LOCAL'), 'a.__var')
|
||||
self.wait_for_evaluation('<var name="a.__var" type="int" value="int')
|
||||
self.wait_for_evaluation('<var name="a.__var" type="int" qualifier="{}" value="int'.format(builtin_qualifier))
|
||||
self.write_run_thread(thread_id)
|
||||
|
||||
|
||||
@@ -258,9 +268,9 @@ class WriterThreadCase16(debugger_unittest.AbstractWriterThread):
|
||||
|
||||
# First pass check is that we have all three expected variables defined
|
||||
self.write_get_frame(thread_id, frame_id)
|
||||
self.wait_for_vars('<var name="smallarray" type="ndarray" value="ndarray%253A %255B 0.%252B1.j 1.%252B1.j 2.%252B1.j 3.%252B1.j 4.%252B1.j 5.%252B1.j 6.%252B1.j 7.%252B1.j%250A 8.%252B1.j 9.%252B1.j 10.%252B1.j 11.%252B1.j 12.%252B1.j 13.%252B1.j 14.%252B1.j 15.%252B1.j%250A 16.%252B1.j 17.%252B1.j 18.%252B1.j 19.%252B1.j 20.%252B1.j 21.%252B1.j 22.%252B1.j 23.%252B1.j%250A 24.%252B1.j 25.%252B1.j 26.%252B1.j 27.%252B1.j 28.%252B1.j 29.%252B1.j 30.%252B1.j 31.%252B1.j%250A 32.%252B1.j 33.%252B1.j 34.%252B1.j 35.%252B1.j 36.%252B1.j 37.%252B1.j 38.%252B1.j 39.%252B1.j%250A 40.%252B1.j 41.%252B1.j 42.%252B1.j 43.%252B1.j 44.%252B1.j 45.%252B1.j 46.%252B1.j 47.%252B1.j%250A 48.%252B1.j 49.%252B1.j 50.%252B1.j 51.%252B1.j 52.%252B1.j 53.%252B1.j 54.%252B1.j 55.%252B1.j%250A 56.%252B1.j 57.%252B1.j 58.%252B1.j 59.%252B1.j 60.%252B1.j 61.%252B1.j 62.%252B1.j 63.%252B1.j%250A 64.%252B1.j 65.%252B1.j 66.%252B1.j 67.%252B1.j 68.%252B1.j 69.%252B1.j 70.%252B1.j 71.%252B1.j%250A 72.%252B1.j 73.%252B1.j 74.%252B1.j 75.%252B1.j 76.%252B1.j 77.%252B1.j 78.%252B1.j 79.%252B1.j%250A 80.%252B1.j 81.%252B1.j 82.%252B1.j 83.%252B1.j 84.%252B1.j 85.%252B1.j 86.%252B1.j 87.%252B1.j%250A 88.%252B1.j 89.%252B1.j 90.%252B1.j 91.%252B1.j 92.%252B1.j 93.%252B1.j 94.%252B1.j 95.%252B1.j%250A 96.%252B1.j 97.%252B1.j 98.%252B1.j 99.%252B1.j%255D" isContainer="True" />')
|
||||
self.wait_for_vars('<var name="bigarray" type="ndarray" value="ndarray%253A %255B%255B 0 1 2 ...%252C 9997 9998 9999%255D%250A %255B10000 10001 10002 ...%252C 19997 19998 19999%255D%250A %255B20000 20001 20002 ...%252C 29997 29998 29999%255D%250A ...%252C %250A %255B70000 70001 70002 ...%252C 79997 79998 79999%255D%250A %255B80000 80001 80002 ...%252C 89997 89998 89999%255D%250A %255B90000 90001 90002 ...%252C 99997 99998 99999%255D%255D" isContainer="True" />')
|
||||
self.wait_for_vars('<var name="hugearray" type="ndarray" value="ndarray%253A %255B 0 1 2 ...%252C 9999997 9999998 9999999%255D" isContainer="True" />')
|
||||
self.wait_for_vars('<var name="smallarray" type="ndarray" qualifier="numpy" value="ndarray%253A %255B 0.%252B1.j 1.%252B1.j 2.%252B1.j 3.%252B1.j 4.%252B1.j 5.%252B1.j 6.%252B1.j 7.%252B1.j%250A 8.%252B1.j 9.%252B1.j 10.%252B1.j 11.%252B1.j 12.%252B1.j 13.%252B1.j 14.%252B1.j 15.%252B1.j%250A 16.%252B1.j 17.%252B1.j 18.%252B1.j 19.%252B1.j 20.%252B1.j 21.%252B1.j 22.%252B1.j 23.%252B1.j%250A 24.%252B1.j 25.%252B1.j 26.%252B1.j 27.%252B1.j 28.%252B1.j 29.%252B1.j 30.%252B1.j 31.%252B1.j%250A 32.%252B1.j 33.%252B1.j 34.%252B1.j 35.%252B1.j 36.%252B1.j 37.%252B1.j 38.%252B1.j 39.%252B1.j%250A 40.%252B1.j 41.%252B1.j 42.%252B1.j 43.%252B1.j 44.%252B1.j 45.%252B1.j 46.%252B1.j 47.%252B1.j%250A 48.%252B1.j 49.%252B1.j 50.%252B1.j 51.%252B1.j 52.%252B1.j 53.%252B1.j 54.%252B1.j 55.%252B1.j%250A 56.%252B1.j 57.%252B1.j 58.%252B1.j 59.%252B1.j 60.%252B1.j 61.%252B1.j 62.%252B1.j 63.%252B1.j%250A 64.%252B1.j 65.%252B1.j 66.%252B1.j 67.%252B1.j 68.%252B1.j 69.%252B1.j 70.%252B1.j 71.%252B1.j%250A 72.%252B1.j 73.%252B1.j 74.%252B1.j 75.%252B1.j 76.%252B1.j 77.%252B1.j 78.%252B1.j 79.%252B1.j%250A 80.%252B1.j 81.%252B1.j 82.%252B1.j 83.%252B1.j 84.%252B1.j 85.%252B1.j 86.%252B1.j 87.%252B1.j%250A 88.%252B1.j 89.%252B1.j 90.%252B1.j 91.%252B1.j 92.%252B1.j 93.%252B1.j 94.%252B1.j 95.%252B1.j%250A 96.%252B1.j 97.%252B1.j 98.%252B1.j 99.%252B1.j%255D" isContainer="True" />')
|
||||
self.wait_for_vars('<var name="bigarray" type="ndarray" qualifier="numpy" value="ndarray%253A %255B%255B 0 1 2 ...%252C 9997 9998 9999%255D%250A %255B10000 10001 10002 ...%252C 19997 19998 19999%255D%250A %255B20000 20001 20002 ...%252C 29997 29998 29999%255D%250A ...%252C %250A %255B70000 70001 70002 ...%252C 79997 79998 79999%255D%250A %255B80000 80001 80002 ...%252C 89997 89998 89999%255D%250A %255B90000 90001 90002 ...%252C 99997 99998 99999%255D%255D" isContainer="True" />')
|
||||
self.wait_for_vars('<var name="hugearray" type="ndarray" qualifier="numpy" value="ndarray%253A %255B 0 1 2 ...%252C 9999997 9999998 9999999%255D" isContainer="True" />')
|
||||
|
||||
# For each variable, check each of the resolved (meta data) attributes...
|
||||
self.write_get_variable(thread_id, frame_id, 'smallarray')
|
||||
@@ -275,14 +285,14 @@ class WriterThreadCase16(debugger_unittest.AbstractWriterThread):
|
||||
|
||||
self.write_get_variable(thread_id, frame_id, 'bigarray')
|
||||
self.wait_for_var([
|
||||
'<var name="min" type="int64" value="int64%253A 0" />',
|
||||
'<var name="min" type="int64" value="int64%3A 0" />',
|
||||
'<var name="size" type="int" value="int%3A 100000" />',
|
||||
'<var name="min" type="int64" qualifier="numpy" value="int64%253A 0" />',
|
||||
'<var name="min" type="int64" qualifier="numpy" value="int64%3A 0" />',
|
||||
'<var name="size" type="int" qualifier="{}" value="int%3A 100000" />'.format(builtin_qualifier),
|
||||
])
|
||||
self.wait_for_var([
|
||||
'<var name="max" type="int64" value="int64%253A 99999" />',
|
||||
'<var name="max" type="int32" value="int32%253A 99999" />',
|
||||
'<var name="max" type="int64" value="int64%3A 99999"'
|
||||
'<var name="max" type="int64" qualifier="numpy" value="int64%253A 99999" />',
|
||||
'<var name="max" type="int32" qualifier="numpy" value="int32%253A 99999" />',
|
||||
'<var name="max" type="int64" qualifier="numpy" value="int64%3A 99999"'
|
||||
])
|
||||
self.wait_for_var('<var name="shape" type="tuple"')
|
||||
self.wait_for_var('<var name="dtype" type="dtype"')
|
||||
@@ -294,12 +304,12 @@ class WriterThreadCase16(debugger_unittest.AbstractWriterThread):
|
||||
# the min/max
|
||||
self.write_get_variable(thread_id, frame_id, 'hugearray')
|
||||
self.wait_for_var([
|
||||
'<var name="min" type="str" value="str%253A ndarray too big%252C calculating min would slow down debugging" />',
|
||||
'<var name="min" type="str" value="str%3A ndarray too big%252C calculating min would slow down debugging" />',
|
||||
'<var name="min" type="str" qualifier={} value="str%253A ndarray too big%252C calculating min would slow down debugging" />'.format(builtin_qualifier),
|
||||
'<var name="min" type="str" qualifier={} value="str%3A ndarray too big%252C calculating min would slow down debugging" />'.format(builtin_qualifier),
|
||||
])
|
||||
self.wait_for_var([
|
||||
'<var name="max" type="str" value="str%253A ndarray too big%252C calculating max would slow down debugging" />',
|
||||
'<var name="max" type="str" value="str%3A ndarray too big%252C calculating max would slow down debugging" />',
|
||||
'<var name="max" type="str" qualifier={} value="str%253A ndarray too big%252C calculating max would slow down debugging" />'.format(builtin_qualifier),
|
||||
'<var name="max" type="str" qualifier={} value="str%3A ndarray too big%252C calculating max would slow down debugging" />'.format(builtin_qualifier),
|
||||
])
|
||||
self.wait_for_var('<var name="shape" type="tuple"')
|
||||
self.wait_for_var('<var name="dtype" type="dtype"')
|
||||
@@ -376,7 +386,7 @@ class WriterThreadCase14(debugger_unittest.AbstractWriterThread):
|
||||
'<xml><more>False</more><output message="0"></output><output message="1"></output><output message="2"></output></xml>',
|
||||
'<xml><more>0</more><output message="0"></output><output message="1"></output><output message="2"></output></xml>'
|
||||
]
|
||||
)
|
||||
)
|
||||
assert 17 == self._sequence, 'Expected 19. Had: %s' % self._sequence
|
||||
|
||||
self.write_run_thread(thread_id)
|
||||
@@ -623,13 +633,13 @@ class WriterThreadCase7(debugger_unittest.AbstractWriterThread):
|
||||
|
||||
self.write_get_frame(thread_id, frame_id)
|
||||
|
||||
self.wait_for_vars('<xml><var name="variable_for_test_1" type="int" value="int%253A 10" />%0A</xml>')
|
||||
self.wait_for_vars('<xml><var name="variable_for_test_1" type="int" qualifier="{}" value="int%253A 10" />%0A</xml>'.format(builtin_qualifier))
|
||||
|
||||
self.write_step_over(thread_id)
|
||||
|
||||
self.write_get_frame(thread_id, frame_id)
|
||||
|
||||
self.wait_for_vars('<xml><var name="variable_for_test_1" type="int" value="int%253A 10" />%0A<var name="variable_for_test_2" type="int" value="int%253A 20" />%0A</xml>')
|
||||
self.wait_for_vars('<xml><var name="variable_for_test_1" type="int" qualifier="{0}" value="int%253A 10" />%0A<var name="variable_for_test_2" type="int" qualifier="{0}" value="int%253A 20" />%0A</xml>'.format(builtin_qualifier))
|
||||
|
||||
self.write_run_thread(thread_id)
|
||||
|
||||
@@ -1018,11 +1028,11 @@ class TestPython(unittest.TestCase, DebuggerBase):
|
||||
class TestJython(unittest.TestCase, DebuggerBase):
|
||||
def get_command_line(self):
|
||||
return [
|
||||
JAVA_LOCATION,
|
||||
'-classpath',
|
||||
JYTHON_JAR_LOCATION,
|
||||
'org.python.util.jython'
|
||||
]
|
||||
JAVA_LOCATION,
|
||||
'-classpath',
|
||||
JYTHON_JAR_LOCATION,
|
||||
'org.python.util.jython'
|
||||
]
|
||||
|
||||
# This case requires decorators to work (which are not present on Jython 2.1), so, this test is just removed from the jython run.
|
||||
def test_case_13(self):
|
||||
@@ -1041,9 +1051,9 @@ class TestJython(unittest.TestCase, DebuggerBase):
|
||||
class TestIronPython(unittest.TestCase, DebuggerBase):
|
||||
def get_command_line(self):
|
||||
return [
|
||||
IRONPYTHON_EXE,
|
||||
'-X:Frames'
|
||||
]
|
||||
IRONPYTHON_EXE,
|
||||
'-X:Frames'
|
||||
]
|
||||
|
||||
def test_case_3(self):
|
||||
self.skipTest("Timing issues") # This test fails once in a while due to timing issues on IronPython, so, skipping it.
|
||||
@@ -1140,34 +1150,34 @@ if __name__ == '__main__':
|
||||
# pass
|
||||
suite = unittest.TestSuite()
|
||||
|
||||
# suite.addTests(unittest.makeSuite(TestJython)) # Note: Jython should be 2.2.1
|
||||
#
|
||||
# suite.addTests(unittest.makeSuite(TestIronPython))
|
||||
#
|
||||
# suite.addTests(unittest.makeSuite(TestJython)) # Note: Jython should be 2.2.1
|
||||
#
|
||||
# suite.addTests(unittest.makeSuite(TestIronPython))
|
||||
#
|
||||
suite.addTests(unittest.makeSuite(TestPython))
|
||||
|
||||
|
||||
|
||||
|
||||
# suite.addTest(TestIronPython('test_case_18'))
|
||||
# suite.addTest(TestIronPython('test_case_17'))
|
||||
# suite.addTest(TestIronPython('test_case_3'))
|
||||
# suite.addTest(TestIronPython('test_case_7'))
|
||||
#
|
||||
# suite.addTest(TestPython('test_case_10'))
|
||||
# suite.addTest(TestPython('test_case_django'))
|
||||
# suite.addTest(TestPython('test_case_qthread1'))
|
||||
# suite.addTest(TestPython('test_case_qthread2'))
|
||||
# suite.addTest(TestPython('test_case_qthread3'))
|
||||
# suite.addTest(TestIronPython('test_case_18'))
|
||||
# suite.addTest(TestIronPython('test_case_17'))
|
||||
# suite.addTest(TestIronPython('test_case_3'))
|
||||
# suite.addTest(TestIronPython('test_case_7'))
|
||||
#
|
||||
# suite.addTest(TestPython('test_case_10'))
|
||||
# suite.addTest(TestPython('test_case_django'))
|
||||
# suite.addTest(TestPython('test_case_qthread1'))
|
||||
# suite.addTest(TestPython('test_case_qthread2'))
|
||||
# suite.addTest(TestPython('test_case_qthread3'))
|
||||
|
||||
# suite.addTest(TestPython('test_case_17a'))
|
||||
# suite.addTest(TestPython('test_case_17a'))
|
||||
|
||||
|
||||
# suite.addTest(TestJython('test_case_1'))
|
||||
# suite.addTest(TestPython('test_case_2'))
|
||||
# unittest.TextTestRunner(verbosity=3).run(suite)
|
||||
# suite.addTest(TestPython('test_case_17'))
|
||||
# suite.addTest(TestPython('test_case_18'))
|
||||
# suite.addTest(TestPython('test_case_19'))
|
||||
# suite.addTest(TestJython('test_case_1'))
|
||||
# suite.addTest(TestPython('test_case_2'))
|
||||
# unittest.TextTestRunner(verbosity=3).run(suite)
|
||||
# suite.addTest(TestPython('test_case_17'))
|
||||
# suite.addTest(TestPython('test_case_18'))
|
||||
# suite.addTest(TestPython('test_case_19'))
|
||||
|
||||
unittest.TextTestRunner(verbosity=3).run(suite)
|
||||
|
||||
Reference in New Issue
Block a user