Fix some tests to correctly run under weave on Win32
Store/restore preferences when running the test suite