def METHOD_NAME(self, mock_write_file, mock_open):
    """Preferences().set_pref should write file on file-backed config platforms"""
    for actual_platform in self.PRIMARY_NON_MACOS_PLATFORMS:
        with self.subTest(platform=actual_platform):
            self.mock_platform.return_value = actual_platform
            fake_prefs = Preferences()
            self.assertNotEqual(fake_prefs.file_path, None)
            fake_prefs.set_pref("TEST_KEY", "fake_value")
            mock_write_file.assert_called()
            value = fake_prefs.get_pref("TEST_KEY")
            self.assertEqual(value, "fake_value")
            mock_write_file.reset_mock()