mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 14:34:31 +08:00
use absolute paths as the default for 'Script'
This commit is contained in:
@@ -10,6 +10,7 @@ from __future__ import with_statement
|
|||||||
__all__ = ['Script', 'NotFoundError', 'set_debug_function', '_quick_complete']
|
__all__ = ['Script', 'NotFoundError', 'set_debug_function', '_quick_complete']
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
import os
|
||||||
|
|
||||||
import parsing
|
import parsing
|
||||||
import dynamic
|
import dynamic
|
||||||
@@ -59,11 +60,12 @@ class Script(object):
|
|||||||
self.pos = line, column
|
self.pos = line, column
|
||||||
self._module = modules.ModuleWithCursor(source_path,
|
self._module = modules.ModuleWithCursor(source_path,
|
||||||
source=self.source, position=self.pos)
|
source=self.source, position=self.pos)
|
||||||
self.source_path = source_path
|
self._source_path = source_path
|
||||||
|
self.source_path = os.path.abspath(source_path)
|
||||||
debug.speed('init')
|
debug.speed('init')
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '<%s: %s>' % (self.__class__.__name__, repr(self.source_path))
|
return '<%s: %s>' % (self.__class__.__name__, repr(self._source_path))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _parser(self):
|
def _parser(self):
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ def run_test(source, f_name, lines_to_execute):
|
|||||||
if lines_to_execute and line_nr - 1 not in lines_to_execute:
|
if lines_to_execute and line_nr - 1 not in lines_to_execute:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
path = refactoring_test_dir + os.path.sep + f_name
|
path = os.path.abspath(refactoring_test_dir + os.path.sep + f_name)
|
||||||
try:
|
try:
|
||||||
script = api.Script(source, line_nr, index, path)
|
script = api.Script(source, line_nr, index, path)
|
||||||
refactor_func = getattr(refactoring, f_name.replace('.py', ''))
|
refactor_func = getattr(refactoring, f_name.replace('.py', ''))
|
||||||
|
|||||||
Reference in New Issue
Block a user