[FIX] core: env.clear() also invalidates lazy properties
In unit tests, this avoids side effects from one test to another. In particular, a test modifying the user's company can make other tests fail because `env.company` defaults to the user's company when nothing else is available in the context.
This commit is contained in:
@@ -613,6 +613,7 @@ class Environment(Mapping):
|
||||
""" Clear all record caches, and discard all fields to recompute.
|
||||
This may be useful when recovering from a failed ORM operation.
|
||||
"""
|
||||
lazy_property.reset_all(self)
|
||||
self.cache.invalidate()
|
||||
self.all.tocompute.clear()
|
||||
self.all.towrite.clear()
|
||||
|
||||
Reference in New Issue
Block a user