summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manager.py9
-rw-r--r--raw_building.py3
-rw-r--r--test/unittest_manager.py9
-rw-r--r--test/unittest_python3.py4
-rw-r--r--test/unittest_regrtest.py3
5 files changed, 16 insertions, 12 deletions
diff --git a/manager.py b/manager.py
index ec43f3a4..cd5cde6e 100644
--- a/manager.py
+++ b/manager.py
@@ -310,6 +310,15 @@ class AstroidManager(OptionsProviderMixIn):
"""Cache a module if no module with the same name is known yet."""
self.astroid_cache.setdefault(module.name, module)
+ def clear_cache(self):
+ self.astroid_cache.clear()
+ # force bootstrap again, else we may ends up with cache inconsistency
+ # between the manager and CONST_PROXY, making
+ # unittest_lookup.LookupTC.test_builtin_lookup fail depending on the
+ # test order
+ from astroid.raw_building import astroid_bootstrapping
+ astroid_bootstrapping()
+
class Project(object):
"""a project handle a set of modules / packages"""
diff --git a/raw_building.py b/raw_building.py
index 074a261f..c2739df9 100644
--- a/raw_building.py
+++ b/raw_building.py
@@ -331,7 +331,6 @@ Astroid_BUILDER = InspectBuilder()
_CONST_PROXY = {}
def astroid_bootstrapping():
"""astroid boot strapping the builtins module"""
- print 'astroid_bootstrapping'
# this boot strapping is necessary since we need the Const nodes to
# inspect_build builtins, and then we can proxy Const
from logilab.common.compat import builtins
@@ -346,7 +345,7 @@ def astroid_bootstrapping():
node_cls._proxied = proxy
else:
_CONST_PROXY[cls] = proxy
- MANAGER.astroid_cache[builtins.__name__] = astroid_builtin
+
astroid_bootstrapping()
# TODO : find a nicer way to handle this situation;
diff --git a/test/unittest_manager.py b/test/unittest_manager.py
index 321f9541..3e7bd62c 100644
--- a/test/unittest_manager.py
+++ b/test/unittest_manager.py
@@ -1,4 +1,4 @@
-# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of astroid.
@@ -30,12 +30,7 @@ PY3K = sys.version_info > (3, 0)
class AstroidManagerTC(TestCase):
def setUp(self):
self.manager = AstroidManager()
- self.manager.astroid_cache.clear()
- # force bootstrap again, else we may ends up with cache inconsistency
- # between the manager and CONST_PROXY, making
- # unittest_lookup.LookupTC.test_builtin_lookup fail depending on the
- # test order
- astroid_bootstrapping()
+ self.manager.clear_cache() # take care of borg
def test_ast_from_file(self):
"""check if the method return a good astroid object"""
diff --git a/test/unittest_python3.py b/test/unittest_python3.py
index f6d14537..57cea49a 100644
--- a/test/unittest_python3.py
+++ b/test/unittest_python3.py
@@ -1,4 +1,4 @@
-# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of astroid.
@@ -29,8 +29,8 @@ from astroid.scoped_nodes import Class, Function
class Python3TC(TestCase):
def setUp(self):
self.manager = AstroidManager()
+ self.manager.clear_cache() # take care of borg
self.builder = AstroidBuilder(self.manager)
- self.manager.astroid_cache.clear()
@require_version('3.0')
def test_starred_notation(self):
diff --git a/test/unittest_regrtest.py b/test/unittest_regrtest.py
index 9a626035..fb11c46e 100644
--- a/test/unittest_regrtest.py
+++ b/test/unittest_regrtest.py
@@ -1,4 +1,4 @@
-# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of astroid.
@@ -42,6 +42,7 @@ class NonRegressionTC(TestCase):
manager.astroid_cache = {}
manager._mod_file_cache = {}
manager.transforms = {}
+ manager.clear_cache() # trigger proper bootstraping
return manager
def test_module_path(self):