Some more sys path corrections.

The sys path should be defined more or less in the beginning and not be different for all modules
This commit is contained in:
Dave Halter
2018-02-16 14:39:01 +01:00
parent 6a11b7d89e
commit 039e7ba07b
4 changed files with 8 additions and 14 deletions

View File

@@ -64,9 +64,8 @@ class Project(object):
want. By default the ``sys.path.`` is generated from the
environment (virtualenvs, etc).
:param smart_sys_path: If this is enabled (default), adds paths from
Django, buildout and local directories. Otherwise you will have to
rely on your packages being properly configured on the
``sys.path``.
local directories. Otherwise you will have to rely on your packages
being properly configured on the ``sys.path``.
"""
def py2_comp(path, environment=None, sys_path=None,
smart_sys_path=True, _django=False):

View File

@@ -264,11 +264,6 @@ class Importer(object):
def sys_path_with_modifications(self):
sys_path_mod = self._evaluator.get_sys_path() \
+ sys_path.check_sys_path_modifications(self.module_context)
if self.file_path is not None:
# Since we know nothing about the call location of the sys.path,
# it's a possibility that the current directory is the origin of
# the Python execution.
sys_path_mod.append(force_unicode(os.path.dirname(self.file_path)))
return sys_path_mod

View File

@@ -1,6 +1,6 @@
""" used for renaming tests """
from rename1 import abc
from import_tree.rename1 import abc
abc

View File

@@ -83,18 +83,18 @@ import module_not_exists
module_not_exists
#< ('rename1', 1,0), (0,24), (3,0), (6,17), ('rename2', 4,5), (11,17), (14,17), ('imports', 72, 16)
#< ('rename1', 1,0), (0,24), (3,0), (6,17), ('rename2', 4,17), (11,17), (14,17), ('imports', 72, 16)
from import_tree import rename1
#< (0,8), ('rename1',3,0), ('rename2',4,20), ('rename2',6,0), (3,32), (8,32), (5,0)
#< (0,8), ('rename1',3,0), ('rename2',4,32), ('rename2',6,0), (3,32), (8,32), (5,0)
rename1.abc
#< (-3,8), ('rename1', 3,0), ('rename2', 4,20), ('rename2', 6,0), (0,32), (5,32), (2,0)
#< (-3,8), ('rename1', 3,0), ('rename2', 4,32), ('rename2', 6,0), (0,32), (5,32), (2,0)
from import_tree.rename1 import abc
#< (-5,8), (-2,32), ('rename1', 3,0), ('rename2', 4,20), ('rename2', 6,0), (0,0), (3,32)
#< (-5,8), (-2,32), ('rename1', 3,0), ('rename2', 4,32), ('rename2', 6,0), (0,0), (3,32)
abc
#< 20 ('rename1', 1,0), ('rename2', 4,5), (-11,24), (-8,0), (-5,17), (0,17), (3,17), ('imports', 72, 16)
#< 20 ('rename1', 1,0), ('rename2', 4,17), (-11,24), (-8,0), (-5,17), (0,17), (3,17), ('imports', 72, 16)
from import_tree.rename1 import abc
#< (0, 32),