[issue36485] Add a way to clear all caches

2019-04-01 Thread Brett Cannon
Brett Cannon added the comment: RE: "And do you think polling for a new magic attribute is the right approach?": my thinking behind that idea is that by standardizing the function name it's easy to tell if there's a cache, but you can also do away with the registration with a 3 lines of

[issue36485] Add a way to clear all caches

2019-03-31 Thread Ma Lin
Ma Lin added the comment: > My initial idea was to add a lightweight module cachesreg with two functions: > register() and clear_caches(). If it only has two functions, it could be a sub-module sys.cachesreg Or a lifecycle module, as the name, dedicated to such kind of functions. Register

[issue36485] Add a way to clear all caches

2019-03-31 Thread Anders Hovmöller
Anders Hovmöller added the comment: I think this is a great idea. We would have needed this many times for tests over the years. -- nosy: +Anders.Hovmöller ___ Python tracker

[issue36485] Add a way to clear all caches

2019-03-31 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +12571 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36485] Add a way to clear all caches

2019-03-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: My initial idea was to add a lightweight module cachesreg with two functions: register() and clear_caches(). PR 12639 implements it. But I like Brett's idea more, because it is simpler. The only disadvantage of it is that if you make a typo in

[issue36485] Add a way to clear all caches

2019-03-31 Thread Ma Lin
Ma Lin added the comment: I suggest the documentation be written in more detail. For example, in __clearcache__'s section, state explicitly that this magic function is for module-level cache, and it will be invoked by sys.clear_caches(). Maybe also introduce the background: some caches may

[issue36485] Add a way to clear all caches

2019-03-30 Thread Michael Foord
Michael Foord added the comment: Tests codify knowledge about the system under test, so it doesn't matter that the test suite has to know how to clear caches. It's specifically a good thing that the test writer knows which caches exist and need clearing, and how to do it. The harder thing

[issue36485] Add a way to clear all caches

2019-03-30 Thread Michael Foord
Michael Foord added the comment: > On 30 Mar 2019, at 23:48, Michael Foord wrote: > > > Michael Foord added the comment: > > An auto-magic cache clearing mechanism is really tempting. I tend to agree > with Raymond though, if code needs and progress a cache clearing mechanism it >

[issue36485] Add a way to clear all caches

2019-03-30 Thread Michael Foord
Michael Foord added the comment: An auto-magic cache clearing mechanism is really tempting. I tend to agree with Raymond though, if code needs and progress a cache clearing mechanism it should be treated and accessible. They're are probably some problematic caches still within unittest

[issue36485] Add a way to clear all caches

2019-03-30 Thread Raymond Hettinger
Raymond Hettinger added the comment: Not sure that I agree there is a testing need to clear all caches regardless of what they do. Test code should explicitly state whether it relies on a particular cache being cleared at some particular point in time. Also, the concept of "need to clear

[issue36485] Add a way to clear all caches

2019-03-30 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +12563 stage: -> patch review ___ Python tracker ___ ___

[issue36485] Add a way to clear all caches

2019-03-30 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : Some modules have caches. There is a need to clear all tests before running tests. Brett proposed to add in all modules with caches a function with the standardized name which is responsible for clearing module related caches. [1] The proposed PR adds a