From f1922593839232f6aedabf89b33b2ceb959d0b67 Mon Sep 17 00:00:00 2001 From: David Halter Date: Mon, 7 Jan 2013 14:29:34 +0100 Subject: [PATCH] use absolute paths as the default for 'Script' --- jedi/api.py | 6 ++++-- test/refactor.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/jedi/api.py b/jedi/api.py index 609fdb37..ef72d33e 100644 --- a/jedi/api.py +++ b/jedi/api.py @@ -10,6 +10,7 @@ from __future__ import with_statement __all__ = ['Script', 'NotFoundError', 'set_debug_function', '_quick_complete'] import re +import os import parsing import dynamic @@ -59,11 +60,12 @@ class Script(object): self.pos = line, column self._module = modules.ModuleWithCursor(source_path, 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') def __repr__(self): - return '<%s: %s>' % (self.__class__.__name__, repr(self.source_path)) + return '<%s: %s>' % (self.__class__.__name__, repr(self._source_path)) @property def _parser(self): diff --git a/test/refactor.py b/test/refactor.py index 92923b09..b20f4d1a 100755 --- a/test/refactor.py +++ b/test/refactor.py @@ -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: continue - path = refactoring_test_dir + os.path.sep + f_name + path = os.path.abspath(refactoring_test_dir + os.path.sep + f_name) try: script = api.Script(source, line_nr, index, path) refactor_func = getattr(refactoring, f_name.replace('.py', ''))