refactoring of a few tests

This commit is contained in:
David Halter
2012-12-09 21:38:39 +01:00
parent 830f50e314
commit 9dfa98c474
2 changed files with 25 additions and 22 deletions

View File

@@ -102,10 +102,11 @@ class ImportPath(parsing.Base):
if self.import_stmt.relative_count == 0:
names += self.get_module_names()
path = os.path.abspath(self.file_path)
for i in range(self.import_stmt.relative_count - 1):
path = os.path.dirname(path)
names += self.get_module_names([path])
if self.file_path is not None:
path = os.path.abspath(self.file_path)
for i in range(self.import_stmt.relative_count - 1):
path = os.path.dirname(path)
names += self.get_module_names([path])
else:
if on_import_stmt and isinstance(scope, parsing.Module) \
and scope.path.endswith('__init__.py'):