def setUp(self): self._mocks = [] self._iappinfo = get_utility(IAppInfo) # Shell will provide this utility remove_utility(IAppInfo) # If the locale is changed here, gui tests will break mocked = mock.patch.dict(get_settings()._root, clear=True) self._mocks.append(mocked) # Do not show the splash screen during the tests mocked = mock.patch('stoqlib.gui.splash.show_splash', new=lambda: None) self._mocks.append(mocked) # If a dependency is missing, avoid showing an error message # or else jenkins will hang mocked = mock.patch('stoq.lib.dependencies.DependencyChecker._error', new=lambda *args: None) self._mocks.append(mocked) for mocked in self._mocks: mocked.start()
def setUp(self): self._mocks = [] self._iappinfo = get_utility(IAppInfo) # Shell will provide this utility remove_utility(IAppInfo) # If the locale is changed here, gui tests will break mocked = mock.patch.dict(get_settings()._root, clear=True) self._mocks.append(mocked) # Do not show the splash screen during the tests mocked = mock.patch('stoqlib.gui.widgets.splash.show_splash', new=lambda: None) self._mocks.append(mocked) # If a dependency is missing, avoid showing an error message # or else jenkins will hang mocked = mock.patch('stoq.lib.dependencies.DependencyChecker._error', new=lambda *args: None) self._mocks.append(mocked) for mocked in self._mocks: mocked.start()
def testRemove(self): self.assertRaises(NotImplementedError, remove_utility, IBanana) provide_utility(IBanana, o) self.assertEqual(remove_utility(IBanana), o) self.assertRaises(NotImplementedError, remove_utility, IBanana)