def test_reload_custom(self):
     reloader = mock.Mock()
     watcher = config.ConfigurationWatcher(self.loader,
                                           self.filename,
                                           reloader=reloader)
     watcher.reload()
     reloader.assert_called_with()
Ejemplo n.º 2
0
 def setup_mocks_and_config_watcher(self):
     self.loader = mock.Mock()
     with mock.patch('staticconf.config.time') as self.mock_time:
         with mock.patch('staticconf.config.os.stat') as self.mock_stat:
             with tempfile.NamedTemporaryFile() as file:
                 with mock.patch('staticconf.config.os.path') as self.mock_path:
                     file.flush()
                     self.mock_stat.return_value.st_ino = 1
                     self.mock_stat.return_value.st_dev = 2
                     self.filename = file.name
                     self.watcher = config.ConfigurationWatcher(
                             self.loader, self.filename)
                     yield
 def setup_mocks_and_config_watcher(self):
     self.loader = mock.Mock()
     with contextlib.nested(
             mock.patch('staticconf.config.time'),
             mock.patch('staticconf.config.os.path'),
             mock.patch('staticconf.config.os.stat'),
             tempfile.NamedTemporaryFile()) as (self.mock_time,
                                                self.mock_path,
                                                self.mock_stat, file):
         # Create the file
         file.flush()
         self.mock_stat.st_ino = 1
         self.mock_stat.st_dev = 2
         self.filename = file.name
         self.watcher = config.ConfigurationWatcher(self.loader,
                                                    self.filename)
         yield