diff options
| author | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-01-15 15:27:20 +0200 |
|---|---|---|
| committer | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-01-15 15:27:20 +0200 |
| commit | 73721b28765c81764b5aec7bc9dc0b4d43db79d3 (patch) | |
| tree | 726668f2e77b7204e0e7aa1e9d8bbc1d9837acc2 /astroid/manager.py | |
| parent | b94b983211b7bd019a70e2e1ab19b9c5fffe141d (diff) | |
| download | astroid-git-73721b28765c81764b5aec7bc9dc0b4d43db79d3.tar.gz | |
Fix the test's astroid cache problem.
There were two problems until now:
* first, the transformed builtin object was deleting during clear_cache,
leaving the next tests to use the untransformed tests, which yielded
InferenceErrors.
* after the first problem was fixed, another problem with CONST_PROXY
occurred, since it was creating a new builtins object, without
the builtins transformations applied, which was used for creating
the const classes. The problem was that even replacing the
builtins instance in astroid_cache, InferenceErrors occurred,
because the const classes were already built and they were referencing
the untransformed builtins. That's why _astroid_bootstrapping
allows to receive a new builtins object, which is passed
properly by the tests.
Diffstat (limited to 'astroid/manager.py')
| -rw-r--r-- | astroid/manager.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/astroid/manager.py b/astroid/manager.py index f5a2404c..322cff93 100644 --- a/astroid/manager.py +++ b/astroid/manager.py @@ -348,15 +348,16 @@ 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): + def clear_cache(self, astroid_builtin=None): # XXX clear transforms 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() + import astroid.raw_building + astroid.raw_building._astroid_bootstrapping( + astroid_builtin=astroid_builtin) class Project(object): |
