mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 05:54:25 +08:00
Fixed bug in sith.py related to recording / serialization
This commit is contained in:
11
sith.py
11
sith.py
@@ -77,6 +77,11 @@ class TestCase(object):
|
|||||||
def __init__(self, operation, path, line, column, traceback=None):
|
def __init__(self, operation, path, line, column, traceback=None):
|
||||||
if operation not in self.operations:
|
if operation not in self.operations:
|
||||||
raise ValueError("%s is not a valid operation" % operation)
|
raise ValueError("%s is not a valid operation" % operation)
|
||||||
|
|
||||||
|
# Store call arguments
|
||||||
|
self.call_args = (operation, path, line, column, traceback)
|
||||||
|
|
||||||
|
# Set other attributes
|
||||||
self.operation = operation
|
self.operation = operation
|
||||||
self.path = path
|
self.path = path
|
||||||
self.line = line
|
self.line = line
|
||||||
@@ -86,8 +91,8 @@ class TestCase(object):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def from_cache(cls, record):
|
def from_cache(cls, record):
|
||||||
with open(record) as f:
|
with open(record) as f:
|
||||||
dct = json.load(f)
|
args = json.load(f)
|
||||||
return cls(**dct)
|
return cls(*args)
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
'completions', 'goto_assignments', 'goto_definitions', 'usages',
|
'completions', 'goto_assignments', 'goto_definitions', 'usages',
|
||||||
@@ -124,7 +129,7 @@ class TestCase(object):
|
|||||||
self.traceback = traceback.format_exc()
|
self.traceback = traceback.format_exc()
|
||||||
if record is not None:
|
if record is not None:
|
||||||
with open(record, 'w') as f:
|
with open(record, 'w') as f:
|
||||||
json.dump(self.__dict__, f)
|
json.dump(self.call_args, f)
|
||||||
self.show_errors()
|
self.show_errors()
|
||||||
if debugger:
|
if debugger:
|
||||||
einfo = sys.exc_info()
|
einfo = sys.exc_info()
|
||||||
|
|||||||
Reference in New Issue
Block a user