_views_discover_default_views() has no mechanism for clearing its static cache. This generally does not pose problems as changes in the default views are usually accompanied by a new page request (e.g. a module is enabled or disabled). However there is one important case where it's turning out to be a real showstopper: testing. In running simpletests against an install profile, it's very frequent for
menu_rebuild() to occur before all modules for the install profile have been installed. If this occurs, the views default static cache that is populated for the rest of the simpletest is stale and cannot be cleared even by a subsequent
menu_rebuild(), meaning that a whole set of page views become untestable.
The attached patch provides a static cache reset for the views default views and propagates the change into the various API functions for retrieving views. This means when you do set the reset flag you really will get a fresh copy of the view including any possible changes in the defaults.
Patch generated from DRUPAL-6--2 branch, applies to both 2.x and 3.x.