| 9 | class UpdateSettingsTest(unittest.TestCase): |
| 10 | |
| 11 | def setUp(self): |
| 12 | # Mock out the path to the settings.yml file so that it points to a file |
| 13 | # path that the test controls. |
| 14 | |
| 15 | # Ignore pylint because we perform a tear down and assert the temporary |
| 16 | # files are gone. |
| 17 | # pylint: disable=consider-using-with |
| 18 | self.mock_settings_dir = tempfile.TemporaryDirectory() |
| 19 | self.settings_file_path = os.path.join(self.mock_settings_dir.name, |
| 20 | 'settings.yml') |
| 21 | |
| 22 | path_patch = mock.patch.object(update.settings, '_SETTINGS_FILE_PATH', |
| 23 | self.settings_file_path) |
| 24 | self.addCleanup(path_patch.stop) |
| 25 | path_patch.start() |
| 26 | |
| 27 | def tearDown(self): |
| 28 | self.mock_settings_dir.cleanup() |