def testFixture2(self): def MyFix(): return 'This is rubles.' def Cmd(console_, rubles_): console_.Print(rubles_) app = App('test', color=True, buffered_console=True) app.Fixture(MyFix, name='rubles') app.Add(Cmd) self._TestMain(app, 'cmd', 'This is rubles.\n')
def testFixture1(self): def MyFix(): return 'This is a custom fixture' def Cmd(console_, my_fix_): console_.Print(my_fix_) app = App('test', color=True, buffered_console=True) app.Fixture(MyFix) app.Add(Cmd) self._TestMain(app, 'cmd', 'This is a custom fixture\n')
def testFixtureWithFinalizer(self): finalizer = Mock() def MyFix(): yield 'This is rubles.' finalizer() def Cmd(console_, rubles_): console_.Print(rubles_) app = App('test', color=True, buffered_console=True) app.Fixture(MyFix, name='rubles') app.Add(Cmd) self._TestMain(app, 'cmd', 'This is rubles.\n') finalizer.assert_called_once_with()