Improved Session._reinitialize().

The variables _is_test and _is_add_to_repository_test now both survive
reinitialization.