def trace_memory_clean_caches(self): """ Avoid polluting results with some builtin python caches """ urllib.parse.clear_cache() re.purge() linecache.clearcache() copyreg.clear_extension_cache() if hasattr(fnmatch, "purge"): fnmatch.purge() # pylint: disable=no-member elif hasattr(fnmatch, "_purge"): fnmatch._purge() if hasattr(encodings, "_cache") and len(encodings._cache) > 0: encodings._cache = {} context.log.handler.flush()
def trace_memory_clean_caches(self): """ Avoid polluting results with some builtin python caches """ urlparse.clear_cache() re.purge() linecache.clearcache() copy_reg.clear_extension_cache() if hasattr(fnmatch, "purge"): fnmatch.purge() # pylint: disable=no-member elif hasattr(fnmatch, "_purge"): fnmatch._purge() if hasattr(encodings, "_cache") and len(encodings._cache) > 0: encodings._cache = {} context.log.handler.flush()
def tearDown(self): _purge()