The following issue occurs nondeterministically: a test fails when
trying to flush pending updates with a user id that does not exist.
This only happens with `SavepointCase` tests.
Here is the explanation: the method `cr.savepoint()` retrieves an
environment to flush pending updates, and the chosen environment has a
user that was created in another test, and thus no longer exists. The
problem is that `Environments.envs` contains environments that are no
longer supposed to be used.
The solution consists in, after the test, discarding the environments
that were not present before the test.
closesodoo/odoo#37341
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>