DebugClients/Python3/DebugClientBase.py

changeset 3032
927a2f8b3669
parent 3021
801289962f4e
child 3085
4a0f54a64496
equal deleted inserted replaced
3031:ed2eaa573ca5 3032:927a2f8b3669
857 import unittest 857 import unittest
858 utModule = imp.load_source(tn, fn) 858 utModule = imp.load_source(tn, fn)
859 try: 859 try:
860 if failed: 860 if failed:
861 self.test = unittest.defaultTestLoader\ 861 self.test = unittest.defaultTestLoader\
862 .loadTestsFromNames(failed, utModule) 862 .loadTestsFromNames(failed, utModule)
863 else: 863 else:
864 self.test = unittest.defaultTestLoader\ 864 self.test = unittest.defaultTestLoader\
865 .loadTestsFromName(tfn, utModule) 865 .loadTestsFromName(tfn, utModule)
866 except AttributeError: 866 except AttributeError:
867 self.test = unittest.defaultTestLoader\ 867 self.test = unittest.defaultTestLoader\
868 .loadTestsFromModule(utModule) 868 .loadTestsFromModule(utModule)
869 except: 869 except:
870 exc_type, exc_value, exc_tb = sys.exc_info() 870 exc_type, exc_value, exc_tb = sys.exc_info()
871 self.write('{0}{1}\n'.format( 871 self.write('{0}{1}\n'.format(
872 DebugProtocol.ResponseUTPrepared, 872 DebugProtocol.ResponseUTPrepared,
873 str((0, str(exc_type), str(exc_value))))) 873 str((0, str(exc_type), str(exc_value)))))
1017 del sys.modules['PyProfile'] 1017 del sys.modules['PyProfile']
1018 except KeyError: 1018 except KeyError:
1019 pass 1019 pass
1020 return self.clientCapabilities 1020 return self.clientCapabilities
1021 except ImportError: 1021 except ImportError:
1022 return (self.clientCapabilities & 1022 return (self.clientCapabilities &
1023 ~DebugClientCapabilities.HasProfiler) 1023 ~DebugClientCapabilities.HasProfiler)
1024 1024
1025 def write(self, s): 1025 def write(self, s):
1026 """ 1026 """
1027 Public method to write data to the output stream. 1027 Public method to write data to the output stream.
1430 oaccess = access 1430 oaccess = access
1431 else: 1431 else:
1432 oaccess = '' 1432 oaccess = ''
1433 try: 1433 try:
1434 loc = {"dict": dict} 1434 loc = {"dict": dict}
1435 exec('mdict = dict{0!s}.__dict__\nobj = dict{0!s}'\ 1435 exec('mdict = dict{0!s}.__dict__\nobj = dict{0!s}'
1436 .format(access), globals(), loc) 1436 .format(access), globals(), loc)
1437 mdict = loc["mdict"] 1437 mdict = loc["mdict"]
1438 obj = loc["obj"] 1438 obj = loc["obj"]
1439 if "PyQt4." in str(type(obj)): 1439 if "PyQt4." in str(type(obj)):
1440 qtVariable = True 1440 qtVariable = True
1443 ndict.update(mdict) 1443 ndict.update(mdict)
1444 except: 1444 except:
1445 pass 1445 pass
1446 try: 1446 try:
1447 loc = {"dict": dict} 1447 loc = {"dict": dict}
1448 exec('mcdict = dict{0!s}.__class__.__dict__'\ 1448 exec('mcdict = dict{0!s}.__class__.__dict__'
1449 .format(access), globals(), loc) 1449 .format(access), globals(), loc)
1450 ndict.update(loc["mcdict"]) 1450 ndict.update(loc["mcdict"])
1451 if mdict and not "sipThis" in mdict.keys(): 1451 if mdict and not "sipThis" in mdict.keys():
1452 del rvar[0:2] 1452 del rvar[0:2]
1453 access = "" 1453 access = ""
1459 globals(), loc) 1459 globals(), loc)
1460 for v in loc["slv"]: 1460 for v in loc["slv"]:
1461 try: 1461 try:
1462 loc["v"] = v 1462 loc["v"] = v
1463 exec('cdict[v] = dict{0!s}.{1!s}'.format( 1463 exec('cdict[v] = dict{0!s}.{1!s}'.format(
1464 access, v), 1464 access, v), globals, loc)
1465 globals, loc)
1466 except: 1465 except:
1467 pass 1466 pass
1468 ndict.update(loc["cdict"]) 1467 ndict.update(loc["cdict"])
1469 exec('obj = dict{0!s}'.format(access), 1468 exec('obj = dict{0!s}'.format(access),
1470 globals(), loc) 1469 globals(), loc)
1494 "var": var, "i": i} 1493 "var": var, "i": i}
1495 for v in slv: 1494 for v in slv:
1496 try: 1495 try:
1497 loc["v"] = v 1496 loc["v"] = v
1498 exec('cdict[v] = dict[var[i]].{0!s}' 1497 exec('cdict[v] = dict[var[i]].{0!s}'
1499 .format(v), 1498 .format(v),
1500 globals(), loc) 1499 globals(), loc)
1501 except: 1500 except:
1502 pass 1501 pass
1503 ndict.update(loc["cdict"]) 1502 ndict.update(loc["cdict"])
1504 obj = dict[var[i]] 1503 obj = dict[var[i]]
1513 i += 1 1512 i += 1
1514 1513
1515 if qtVariable: 1514 if qtVariable:
1516 vlist = self.__formatQt4Variable(qvar, qvtype) 1515 vlist = self.__formatQt4Variable(qvar, qvtype)
1517 elif ("sipThis" in dict.keys() and len(dict) == 1) or \ 1516 elif ("sipThis" in dict.keys() and len(dict) == 1) or \
1518 (len(dict) == 0 and len(udict) > 0): 1517 (len(dict) == 0 and len(udict) > 0):
1519 if access: 1518 if access:
1520 loc = {"udict": udict} 1519 loc = {"udict": udict}
1521 exec('qvar = udict{0!s}'.format(access), globals(), loc) 1520 exec('qvar = udict{0!s}'.format(access), globals(), loc)
1522 qvar = loc["qvar"] 1521 qvar = loc["qvar"]
1523 # this has to be in line with VariablesViewer.indicators 1522 # this has to be in line with VariablesViewer.indicators
1815 continue 1814 continue
1816 elif valtype == "sip.enumtype": 1815 elif valtype == "sip.enumtype":
1817 if ConfigVarTypeStrings.index('class') in filter: 1816 if ConfigVarTypeStrings.index('class') in filter:
1818 continue 1817 continue
1819 elif not valtype.startswith("PySide") and \ 1818 elif not valtype.startswith("PySide") and \
1820 ConfigVarTypeStrings.index('other') in filter: 1819 ConfigVarTypeStrings.index('other') in filter:
1821 continue 1820 continue
1822 1821
1823 try: 1822 try:
1824 if valtype not in ['list', 'tuple', 'dict']: 1823 if valtype not in ['list', 'tuple', 'dict']:
1825 rvalue = repr(value) 1824 rvalue = repr(value)

eric ide

mercurial