use absolute paths as the default for 'Script'

This commit is contained in:
David Halter
2013-01-07 14:29:34 +01:00
parent 082db3fdbd
commit f192259383
2 changed files with 5 additions and 3 deletions

View File

@@ -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):

View File

@@ -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', ''))