mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PCQA-84 Fix all failing debugger backend tests
1. Delete Jython tests 2. Rewrite ndarray repr test 3. Small fixes Merge-request: IJ-MR-154111 Merged-by: Egor Eliseev <Egor.Eliseev@jetbrains.com> GitOrigin-RevId: 4cfa66070046db45bcfbb27b70e9d17ab24db8cb
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b1d0538255
commit
825465a0f1
@@ -1,140 +0,0 @@
|
||||
'''
|
||||
@author Fabio Zadrozny
|
||||
'''
|
||||
import sys
|
||||
import unittest
|
||||
import socket
|
||||
import urllib
|
||||
import pytest
|
||||
import pycompletionserver
|
||||
|
||||
|
||||
IS_JYTHON = sys.platform.find('java') != -1
|
||||
DEBUG = 0
|
||||
|
||||
def dbg(s):
|
||||
if DEBUG:
|
||||
sys.stdout.write('TEST %s\n' % s)
|
||||
|
||||
@pytest.mark.skipif(not IS_JYTHON, reason='Jython related test')
|
||||
class TestJython(unittest.TestCase):
|
||||
|
||||
def test_it(self):
|
||||
dbg('ok')
|
||||
|
||||
|
||||
def test_message(self):
|
||||
t = pycompletionserver.CompletionServer(0)
|
||||
t.exit_process_on_kill = False
|
||||
|
||||
l = []
|
||||
l.append(('Def', 'description' , 'args'))
|
||||
l.append(('Def1', 'description1', 'args1'))
|
||||
l.append(('Def2', 'description2', 'args2'))
|
||||
|
||||
msg = t.processor.format_completion_message('test_jyserver.py', l)
|
||||
|
||||
self.assertEqual('@@COMPLETIONS(test_jyserver.py,(Def,description,args),(Def1,description1,args1),(Def2,description2,args2))END@@', msg)
|
||||
|
||||
l = []
|
||||
l.append(('Def', 'desc,,r,,i()ption', ''))
|
||||
l.append(('Def(1', 'descriptio(n1', ''))
|
||||
l.append(('De,f)2', 'de,s,c,ription2', ''))
|
||||
msg = t.processor.format_completion_message(None, l)
|
||||
expected = '@@COMPLETIONS(None,(Def,desc%2C%2Cr%2C%2Ci%28%29ption, ),(Def%281,descriptio%28n1, ),(De%2Cf%292,de%2Cs%2Cc%2Cription2, ))END@@'
|
||||
|
||||
self.assertEqual(expected, msg)
|
||||
|
||||
|
||||
def test_completion_sockets_and_messages(self):
|
||||
dbg('test_completion_sockets_and_messages')
|
||||
t, socket = self.create_connections()
|
||||
self.socket = socket
|
||||
dbg('connections created')
|
||||
|
||||
try:
|
||||
#now that we have the connections all set up, check the code completion messages.
|
||||
msg = urllib.quote_plus('math')
|
||||
|
||||
toWrite = '@@IMPORTS:%sEND@@' % msg
|
||||
dbg('writing' + str(toWrite))
|
||||
socket.send(toWrite) #math completions
|
||||
completions = self.read_msg()
|
||||
dbg(urllib.unquote_plus(completions))
|
||||
|
||||
start = '@@COMPLETIONS('
|
||||
self.assertTrue(completions.startswith(start), '%s DOESNT START WITH %s' % (completions, start))
|
||||
self.assertTrue(completions.find('@@COMPLETIONS') != -1)
|
||||
self.assertTrue(completions.find('END@@') != -1)
|
||||
|
||||
|
||||
msg = urllib.quote_plus('__builtin__.str')
|
||||
toWrite = '@@IMPORTS:%sEND@@' % msg
|
||||
dbg('writing' + str(toWrite))
|
||||
socket.send(toWrite) #math completions
|
||||
completions = self.read_msg()
|
||||
dbg(urllib.unquote_plus(completions))
|
||||
|
||||
start = '@@COMPLETIONS('
|
||||
self.assertTrue(completions.startswith(start), '%s DOESNT START WITH %s' % (completions, start))
|
||||
self.assertTrue(completions.find('@@COMPLETIONS') != -1)
|
||||
self.assertTrue(completions.find('END@@') != -1)
|
||||
|
||||
|
||||
|
||||
finally:
|
||||
try:
|
||||
self.send_kill_msg(socket)
|
||||
|
||||
|
||||
while not t.ended:
|
||||
pass #wait until it receives the message and quits.
|
||||
|
||||
|
||||
socket.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
def get_free_port(self):
|
||||
from _pydev_bundle.pydev_localhost import get_socket_name
|
||||
return get_socket_name(close=True)[1]
|
||||
|
||||
def create_connections(self):
|
||||
'''
|
||||
Creates the connections needed for testing.
|
||||
'''
|
||||
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||
server.bind((pycompletionserver.HOST, 0))
|
||||
server.listen(1) #socket to receive messages.
|
||||
|
||||
from thread import start_new_thread
|
||||
t = pycompletionserver.CompletionServer(server.getsockname()[1])
|
||||
t.exit_process_on_kill = False
|
||||
|
||||
start_new_thread(t.run, ())
|
||||
|
||||
sock, _addr = server.accept()
|
||||
|
||||
return t, sock
|
||||
|
||||
def read_msg(self):
|
||||
msg = '@@PROCESSING_END@@'
|
||||
while msg.startswith('@@PROCESSING'):
|
||||
msg = self.socket.recv(1024)
|
||||
if msg.startswith('@@PROCESSING:'):
|
||||
dbg('Status msg:' + str(msg))
|
||||
|
||||
while msg.find('END@@') == -1:
|
||||
msg += self.socket.recv(1024)
|
||||
|
||||
return msg
|
||||
|
||||
def send_kill_msg(self, socket):
|
||||
socket.send(pycompletionserver.MSG_KILL_SERVER)
|
||||
|
||||
|
||||
|
||||
|
||||
# Run for jython in command line:
|
||||
# c:\bin\jython2.7.0\bin\jython.exe -m py.test tests\test_jyserver.py
|
||||
@@ -1,236 +0,0 @@
|
||||
import unittest
|
||||
import os
|
||||
import sys
|
||||
import pytest
|
||||
|
||||
# Note: ant.jar and junit.jar must be in the PYTHONPATH
|
||||
|
||||
IS_JYTHON = False
|
||||
if sys.platform.find('java') != -1:
|
||||
IS_JYTHON = True
|
||||
from _pydev_bundle._pydev_jy_imports_tipper import ismethod
|
||||
from _pydev_bundle._pydev_jy_imports_tipper import isclass
|
||||
from _pydev_bundle._pydev_jy_imports_tipper import dir_obj
|
||||
from _pydev_bundle import _pydev_jy_imports_tipper
|
||||
from java.lang.reflect import Method #@UnresolvedImport
|
||||
from java.lang import System #@UnresolvedImport
|
||||
from java.lang import String #@UnresolvedImport
|
||||
from java.lang.System import arraycopy #@UnresolvedImport
|
||||
from java.lang.System import out #@UnresolvedImport
|
||||
import java.lang.String #@UnresolvedImport
|
||||
import org.python.core.PyDictionary #@UnresolvedImport
|
||||
|
||||
|
||||
__DBG = 0
|
||||
def dbg(s):
|
||||
if __DBG:
|
||||
sys.stdout.write('%s\n' % (s,))
|
||||
|
||||
|
||||
|
||||
@pytest.mark.skipif(not IS_JYTHON, reason='Jython related test')
|
||||
class TestMod(unittest.TestCase):
|
||||
|
||||
def assert_args(self, tok, args, tips):
|
||||
for a in tips:
|
||||
if tok == a[0]:
|
||||
self.assertEqual(args, a[2])
|
||||
return
|
||||
raise AssertionError('%s not in %s', tok, tips)
|
||||
|
||||
def assert_in(self, tok, tips):
|
||||
self.assertEqual(4, len(tips[0]))
|
||||
for a in tips:
|
||||
if tok == a[0]:
|
||||
return a
|
||||
s = ''
|
||||
for a in tips:
|
||||
s += str(a)
|
||||
s += '\n'
|
||||
raise AssertionError('%s not in %s' % (tok, s))
|
||||
|
||||
def test_imports1a(self):
|
||||
f, tip = _pydev_jy_imports_tipper.generate_tip('java.util.HashMap')
|
||||
assert f.endswith('rt.jar')
|
||||
|
||||
def test_imports1c(self):
|
||||
f, tip = _pydev_jy_imports_tipper.generate_tip('java.lang.Class')
|
||||
assert f.endswith('rt.jar')
|
||||
|
||||
def test_imports1b(self):
|
||||
try:
|
||||
f, tip = _pydev_jy_imports_tipper.generate_tip('__builtin__.m')
|
||||
self.fail('err')
|
||||
except:
|
||||
pass
|
||||
|
||||
def test_imports1(self):
|
||||
f, tip = _pydev_jy_imports_tipper.generate_tip('junit.framework.TestCase')
|
||||
assert f.endswith('junit.jar')
|
||||
ret = self.assert_in('assertEquals', tip)
|
||||
# self.assertEqual('', ret[2])
|
||||
|
||||
def test_imports2(self):
|
||||
f, tip = _pydev_jy_imports_tipper.generate_tip('junit.framework')
|
||||
assert f.endswith('junit.jar')
|
||||
ret = self.assert_in('TestCase', tip)
|
||||
self.assertEqual('', ret[2])
|
||||
|
||||
def test_imports2a(self):
|
||||
f, tip = _pydev_jy_imports_tipper.generate_tip('org.apache.tools.ant')
|
||||
assert f.endswith('ant.jar')
|
||||
ret = self.assert_in('Task', tip)
|
||||
self.assertEqual('', ret[2])
|
||||
|
||||
def test_imports3(self):
|
||||
f, tip = _pydev_jy_imports_tipper.generate_tip('os')
|
||||
assert f.endswith('os.py')
|
||||
ret = self.assert_in('path', tip)
|
||||
self.assertEqual('', ret[2])
|
||||
|
||||
def test_tip_on_string(self):
|
||||
f, tip = _pydev_jy_imports_tipper.generate_tip('string')
|
||||
self.assert_in('join', tip)
|
||||
self.assert_in('uppercase', tip)
|
||||
|
||||
def test_imports(self):
|
||||
tip = _pydev_jy_imports_tipper.generate_tip('__builtin__')[1]
|
||||
self.assert_in('tuple' , tip)
|
||||
self.assert_in('RuntimeError' , tip)
|
||||
self.assert_in('RuntimeWarning' , tip)
|
||||
|
||||
def test_imports5(self):
|
||||
f, tip = _pydev_jy_imports_tipper.generate_tip('java.lang')
|
||||
assert f.endswith('rt.jar')
|
||||
tup = self.assert_in('String' , tip)
|
||||
self.assertEqual(str(_pydev_jy_imports_tipper.TYPE_CLASS), tup[3])
|
||||
|
||||
tip = _pydev_jy_imports_tipper.generate_tip('java')[1]
|
||||
tup = self.assert_in('lang' , tip)
|
||||
self.assertEqual(str(_pydev_jy_imports_tipper.TYPE_IMPORT), tup[3])
|
||||
|
||||
tip = _pydev_jy_imports_tipper.generate_tip('java.lang.String')[1]
|
||||
tup = self.assert_in('indexOf' , tip)
|
||||
self.assertEqual(str(_pydev_jy_imports_tipper.TYPE_FUNCTION), tup[3])
|
||||
|
||||
tip = _pydev_jy_imports_tipper.generate_tip('java.lang.String')[1]
|
||||
tup = self.assert_in('charAt' , tip)
|
||||
self.assertEqual(str(_pydev_jy_imports_tipper.TYPE_FUNCTION), tup[3])
|
||||
self.assertEqual('(int)', tup[2])
|
||||
|
||||
tup = self.assert_in('format' , tip)
|
||||
self.assertEqual(str(_pydev_jy_imports_tipper.TYPE_FUNCTION), tup[3])
|
||||
self.assertEqual('(string, objectArray)', tup[2])
|
||||
self.assertTrue(tup[1].find('[Ljava.lang.Object;') == -1)
|
||||
|
||||
tup = self.assert_in('getBytes', tip)
|
||||
self.assertEqual(str(_pydev_jy_imports_tipper.TYPE_FUNCTION), tup[3])
|
||||
assert '[B' not in tup[1]
|
||||
assert 'byte[]' in tup[1]
|
||||
|
||||
f, tip = _pydev_jy_imports_tipper.generate_tip('__builtin__.str')
|
||||
assert f is None or f.endswith('jython.jar') # Depends on jython version
|
||||
self.assert_in('find' , tip)
|
||||
|
||||
f, tip = _pydev_jy_imports_tipper.generate_tip('__builtin__.dict')
|
||||
assert f is None or f.endswith('jython.jar') # Depends on jython version
|
||||
self.assert_in('get' , tip)
|
||||
|
||||
|
||||
@pytest.mark.skipif(not IS_JYTHON, reason='Jython related test')
|
||||
class TestSearch(unittest.TestCase):
|
||||
|
||||
def test_search_on_jython(self):
|
||||
assert _pydev_jy_imports_tipper.search_definition('os')[0][0].split(os.sep)[-1] in ('javaos.py', 'os.py')
|
||||
self.assertEqual(0, _pydev_jy_imports_tipper.search_definition('os')[0][1])
|
||||
|
||||
assert _pydev_jy_imports_tipper.search_definition('os.makedirs')[0][0].split(os.sep)[-1] in ('javaos.py', 'os.py')
|
||||
self.assertNotEqual(0, _pydev_jy_imports_tipper.search_definition('os.makedirs')[0][1])
|
||||
|
||||
#print _pydev_jy_imports_tipper.search_definition('os.makedirs')
|
||||
|
||||
@pytest.mark.skipif(not IS_JYTHON, reason='Jython related test')
|
||||
class TestCompl(unittest.TestCase):
|
||||
|
||||
def test_getting_info_on_jython(self):
|
||||
|
||||
dbg('\n\n--------------------------- java')
|
||||
assert not ismethod(java)[0]
|
||||
assert not isclass(java)
|
||||
assert _pydev_jy_imports_tipper.ismodule(java)
|
||||
|
||||
dbg('\n\n--------------------------- java.lang')
|
||||
assert not ismethod(java.lang)[0]
|
||||
assert not isclass(java.lang)
|
||||
assert _pydev_jy_imports_tipper.ismodule(java.lang)
|
||||
|
||||
dbg('\n\n--------------------------- Method')
|
||||
assert not ismethod(Method)[0]
|
||||
assert isclass(Method)
|
||||
|
||||
dbg('\n\n--------------------------- System')
|
||||
assert not ismethod(System)[0]
|
||||
assert isclass(System)
|
||||
|
||||
dbg('\n\n--------------------------- String')
|
||||
assert not ismethod(System)[0]
|
||||
assert isclass(String)
|
||||
assert len(dir_obj(String)) > 10
|
||||
|
||||
dbg('\n\n--------------------------- arraycopy')
|
||||
isMet = ismethod(arraycopy)
|
||||
assert isMet[0]
|
||||
assert isMet[1][0].basic_as_str() == "function:arraycopy args=['java.lang.Object', 'int', 'java.lang.Object', 'int', 'int'], varargs=None, kwargs=None, docs:None"
|
||||
assert not isclass(arraycopy)
|
||||
|
||||
dbg('\n\n--------------------------- out')
|
||||
isMet = ismethod(out)
|
||||
assert not isMet[0]
|
||||
assert not isclass(out)
|
||||
|
||||
dbg('\n\n--------------------------- out.println')
|
||||
isMet = ismethod(out.println) #@UndefinedVariable
|
||||
assert isMet[0]
|
||||
assert len(isMet[1]) == 10
|
||||
self.assertEqual(isMet[1][0].basic_as_str(), "function:println args=[], varargs=None, kwargs=None, docs:None")
|
||||
assert isMet[1][1].basic_as_str() == "function:println args=['long'], varargs=None, kwargs=None, docs:None"
|
||||
assert not isclass(out.println) #@UndefinedVariable
|
||||
|
||||
dbg('\n\n--------------------------- str')
|
||||
isMet = ismethod(str)
|
||||
#the code below should work, but is failing on jython 22a1
|
||||
#assert isMet[0]
|
||||
#assert isMet[1][0].basic_as_str() == "function:str args=['org.python.core.PyObject'], varargs=None, kwargs=None, docs:None"
|
||||
assert not isclass(str)
|
||||
|
||||
|
||||
def met1():
|
||||
a = 3
|
||||
return a
|
||||
|
||||
dbg('\n\n--------------------------- met1')
|
||||
isMet = ismethod(met1)
|
||||
assert isMet[0]
|
||||
assert isMet[1][0].basic_as_str() == "function:met1 args=[], varargs=None, kwargs=None, docs:None"
|
||||
assert not isclass(met1)
|
||||
|
||||
def met2(arg1, arg2, *vararg, **kwarg):
|
||||
'''docmet2'''
|
||||
|
||||
a = 1
|
||||
return a
|
||||
|
||||
dbg('\n\n--------------------------- met2')
|
||||
isMet = ismethod(met2)
|
||||
assert isMet[0]
|
||||
assert isMet[1][0].basic_as_str() == "function:met2 args=['arg1', 'arg2'], varargs=vararg, kwargs=kwarg, docs:docmet2"
|
||||
assert not isclass(met2)
|
||||
|
||||
|
||||
# Run for jython in command line:
|
||||
|
||||
# On Windows:
|
||||
# c:/bin/jython2.7.0/bin/jython.exe -Dpython.path=<...>/ant.jar;<...>/junit.jar -m py.test tests/test_jysimpleTipper.py
|
||||
|
||||
# On Linux (different path separator for jars)
|
||||
# jython -Dpython.path=<...>/ant.jar:<...>/junit.jar -m py.test tests/test_jysimpleTipper.py
|
||||
@@ -89,7 +89,6 @@ class TestCPython(unittest.TestCase):
|
||||
|
||||
return msg
|
||||
|
||||
@pytest.mark.xfail(IS_PY39_OR_GREATER, reason="PCQA-731")
|
||||
def test_completion_sockets_and_messages(self):
|
||||
t, socket = self.create_connections()
|
||||
self.socket = socket
|
||||
@@ -107,10 +106,7 @@ class TestCPython(unittest.TestCase):
|
||||
if ('/math.so,' in completions or
|
||||
'/math.cpython-33m.so,' in completions or
|
||||
'/math.cpython-34m.so,' in completions or
|
||||
'math.cpython-35m' in completions or
|
||||
'math.cpython-36m' in completions or
|
||||
'math.cpython-37m' in completions or
|
||||
'math.cpython-38' in completions
|
||||
'math.cpython' in completions
|
||||
):
|
||||
return
|
||||
self.assertTrue(completions.startswith(start) or completions.startswith(start_2), '%s DOESNT START WITH %s' % (completions, (start, start_2)))
|
||||
|
||||
@@ -673,7 +673,6 @@ def test_case_15(case_setup):
|
||||
writer.finished_ok = True
|
||||
|
||||
|
||||
@pytest.mark.xfail(reason="PCQA-702")
|
||||
def test_case_16(case_setup):
|
||||
# numpy.ndarray resolver
|
||||
try:
|
||||
@@ -693,19 +692,19 @@ def test_case_16(case_setup):
|
||||
writer.write_get_frame(hit.thread_id, hit.frame_id)
|
||||
writer.wait_for_multiple_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 8.%252B1.j%250A 9.%252B1.j 10.%252B1.j 11.%252B1.j 12.%252B1.j 13.%252B1.j 14.%252B1.j 15.%252B1.j 16.%252B1.j 17.%252B1.j%250A 18.%252B1.j 19.%252B1.j 20.%252B1.j 21.%252B1.j 22.%252B1.j 23.%252B1.j 24.%252B1.j 25.%252B1.j 26.%252B1.j%250A 27.%252B1.j 28.%252B1.j 29.%252B1.j 30.%252B1.j 31.%252B1.j 32.%252B1.j 33.%252B1.j 34.%252B1.j 35.%252B1.j%250A 36.%252B1.j 37.%252B1.j 38.%252B1.j 39.%252B1.j 40.%252B1.j 41.%252B1.j 42.%252B1.j 43.%252B1.j 44.%252B1.j%250A 45.%252B1.j 46.%252B1.j 47.%252B1.j 48.%252B1.j 49.%252B1.j 50.%252B1.j 51.%252B1.j 52.%252B1.j 53.%252B1.j%250A 54.%252B1.j 55.%252B1.j 56.%252B1.j 57.%252B1.j 58.%252B1.j 59.%252B1.j 60.%252B1.j 61.%252B1.j 62.%252B1.j%250A 63.%252B1.j 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 80.%252B1.j%250A 81.%252B1.j 82.%252B1.j 83.%252B1.j 84.%252B1.j 85.%252B1.j 86.%252B1.j 87.%252B1.j 88.%252B1.j 89.%252B1.j%250A 90.%252B1.j 91.%252B1.j 92.%252B1.j 93.%252B1.j 94.%252B1.j 95.%252B1.j 96.%252B1.j 97.%252B1.j 98.%252B1.j%250A 99.%252B1.j%255D" isContainer="True" />',
|
||||
'<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" />'
|
||||
'<var name="smallarray" type="ndarray" qualifier="numpy"',
|
||||
'<var name="smallarray" type="ndarray" qualifier="numpy"',
|
||||
),
|
||||
|
||||
(
|
||||
'<var name="bigarray" type="ndarray" qualifier="numpy" value="ndarray%253A %255B%255B 0 1 2 ... 9997 9998 9999%255D%250A %255B10000 10001 10002 ... 19997 19998 19999%255D%250A %255B20000 20001 20002 ... 29997 29998 29999%255D%250A ...%250A %255B70000 70001 70002 ... 79997 79998 79999%255D%250A %255B80000 80001 80002 ... 89997 89998 89999%255D%250A %255B90000 90001 90002 ... 99997 99998 99999%255D%255D" isContainer="True" />',
|
||||
'<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" />'
|
||||
'<var name="bigarray" type="ndarray" qualifier="numpy"',
|
||||
'<var name="bigarray" type="ndarray" qualifier="numpy"'
|
||||
),
|
||||
|
||||
# Any of the ones below will do.
|
||||
(
|
||||
'<var name="hugearray" type="ndarray" qualifier="numpy" value="ndarray%253A %255B 0 1 2 ... 9999997 9999998 9999999%255D" isContainer="True" />',
|
||||
'<var name="hugearray" type="ndarray" qualifier="numpy" value="ndarray%253A %255B 0 1 2 ...%252C 9999997 9999998 9999999%255D" isContainer="True" />'
|
||||
'<var name="hugearray" type="ndarray" qualifier="numpy"',
|
||||
'<var name="hugearray" type="ndarray" qualifier="numpy"'
|
||||
)
|
||||
))
|
||||
|
||||
@@ -715,56 +714,47 @@ def test_case_16(case_setup):
|
||||
'<var name="min" type="complex128"',
|
||||
'<var name="max" type="complex128"',
|
||||
'<var name="shape" type="tuple"',
|
||||
'<var name="dtype" type="dtype"',
|
||||
'<var name="size" type="int"',
|
||||
))
|
||||
# ...and check that the internals are resolved properly
|
||||
writer.write_get_variable(hit.thread_id, hit.frame_id, 'smallarray\t__internals__')
|
||||
writer.wait_for_var('<var name="%27size%27')
|
||||
|
||||
writer.write_get_variable(hit.thread_id, hit.frame_id, 'bigarray')
|
||||
# isContainer could be true on some numpy versions, so, we only check for the var begin.
|
||||
writer.wait_for_multiple_vars((
|
||||
[
|
||||
'<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="{0}" value="int%3A 100000"'.format(builtin_qualifier),
|
||||
'<var name="min" type="int64" qualifier="numpy"',
|
||||
'<var name="min" type="int64" qualifier="numpy"',
|
||||
'<var name="size" type="int" qualifier="{0}"'.format(builtin_qualifier),
|
||||
],
|
||||
[
|
||||
'<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"',
|
||||
'<var name="max" type="int32" qualifier="numpy" value="int32%253A 99999"',
|
||||
'<var name="max" type="int64" qualifier="numpy"',
|
||||
'<var name="max" type="int32" qualifier="numpy"',
|
||||
'<var name="max" type="int64" qualifier="numpy"',
|
||||
'<var name="max" type="int32" qualifier="numpy"',
|
||||
],
|
||||
'<var name="shape" type="tuple"',
|
||||
'<var name="dtype" type="dtype"',
|
||||
'<var name="size" type="int"'
|
||||
))
|
||||
writer.write_get_variable(hit.thread_id, hit.frame_id, 'bigarray\t__internals__')
|
||||
writer.wait_for_var('<var name="%27size%27')
|
||||
|
||||
# this one is different because it crosses the magic threshold where we don't calculate
|
||||
# the min/max
|
||||
writer.write_get_variable(hit.thread_id, hit.frame_id, 'hugearray')
|
||||
writer.wait_for_var((
|
||||
[
|
||||
'<var name="min" type="str" qualifier={0} value="str%253A ndarray too big%252C calculating min would slow down debugging" />'.format(builtin_qualifier),
|
||||
'<var name="min" type="str" qualifier={0} value="str%3A ndarray too big%252C calculating min would slow down debugging" />'.format(builtin_qualifier),
|
||||
'<var name="min" type="str" qualifier="{0}" value="str%253A ndarray too big%252C calculating min would slow down debugging" />'.format(builtin_qualifier),
|
||||
'<var name="min" type="str" qualifier="{0}" value="str%3A ndarray too big%252C calculating min would slow down debugging" />'.format(builtin_qualifier),
|
||||
'<var name="min" type="str" qualifier={0}'.format(builtin_qualifier),
|
||||
'<var name="min" type="str" qualifier={0}'.format(builtin_qualifier),
|
||||
'<var name="min" type="str" qualifier="{0}"'.format(builtin_qualifier),
|
||||
'<var name="min" type="str" qualifier="{0}"'.format(builtin_qualifier),
|
||||
],
|
||||
[
|
||||
'<var name="max" type="str" qualifier={0} value="str%253A ndarray too big%252C calculating max would slow down debugging" />'.format(builtin_qualifier),
|
||||
'<var name="max" type="str" qualifier={0} value="str%3A ndarray too big%252C calculating max would slow down debugging" />'.format(builtin_qualifier),
|
||||
'<var name="max" type="str" qualifier="{0}" value="str%253A ndarray too big%252C calculating max would slow down debugging" />'.format(builtin_qualifier),
|
||||
'<var name="max" type="str" qualifier="{0}" value="str%3A ndarray too big%252C calculating max would slow down debugging" />'.format(builtin_qualifier),
|
||||
'<var name="max" type="str" qualifier={0}'.format(builtin_qualifier),
|
||||
'<var name="max" type="str" qualifier={0}'.format(builtin_qualifier),
|
||||
'<var name="max" type="str" qualifier="{0}"'.format(builtin_qualifier),
|
||||
'<var name="max" type="str" qualifier="{0}"'.format(builtin_qualifier),
|
||||
],
|
||||
'<var name="shape" type="tuple"',
|
||||
'<var name="dtype" type="dtype"',
|
||||
'<var name="size" type="int"',
|
||||
))
|
||||
writer.write_get_variable(hit.thread_id, hit.frame_id, 'hugearray\t__internals__')
|
||||
writer.wait_for_var('<var name="%27size%27')
|
||||
|
||||
writer.write_run_thread(hit.thread_id)
|
||||
writer.finished_ok = True
|
||||
@@ -1654,22 +1644,6 @@ def test_case_settrace(case_setup):
|
||||
writer.finished_ok = True
|
||||
|
||||
|
||||
@pytest.mark.skipif(True or IS_PY26 or IS_JYTHON, reason='This is *very* flaky. Scapy only supports 2.7 onwards, not available for jython.')
|
||||
def test_case_scapy(case_setup):
|
||||
with case_setup.test_file('_debugger_case_scapy.py') as writer:
|
||||
writer.FORCE_KILL_PROCESS_WHEN_FINISHED_OK = True
|
||||
writer.reader_thread.set_messages_timeout(30) # Starting scapy may be slow (timed out with 15 seconds on appveyor).
|
||||
writer.write_add_breakpoint(2, None)
|
||||
writer.write_make_initial_run()
|
||||
|
||||
hit = writer.wait_for_breakpoint_hit()
|
||||
thread_id = hit.thread_id
|
||||
frame_id = hit.frame_id
|
||||
|
||||
writer.write_run_thread(thread_id)
|
||||
writer.finished_ok = True
|
||||
|
||||
|
||||
@pytest.mark.skipif(IS_APPVEYOR or IS_JYTHON, reason='Flaky on appveyor / Jython encoding issues (needs investigation).')
|
||||
def test_redirect_output(case_setup):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user