예제 #1
0
 def setUp(self):
     self.stdout = sys.stdout
     self.output = {}
     sys.stdout = helpers.DevNull(self.output)
     sys.modules['argparse'] = None
     helpers.reload(ui)
     ui.debug = True
     def system_interrupt(*args):
         raise KeyboardInterrupt()
     os.system = system_interrupt
예제 #2
0
 def setUp(self):
     self.exit_status = None
     def fake_exit(s):
         self.exit_status = s
         raise helpers.FakeExit()
     self.exit = sys.exit
     sys.exit = fake_exit
     sys.argv = _argv
     self.stdout = sys.stdout
     self.output = {}
     sys.stdout = helpers.DevNull(self.output)
예제 #3
0
    def setUp(self):
        def _loop(*args, **kwargs):
            self._game_loop_started = True

        store = NamedTemporaryFile(delete=False)
        self.exit_status = None

        def fake_exit(s):
            self.exit_status = s
            raise helpers.FakeExit()

        self.exit = sys.exit
        sys.exit = fake_exit
        sys.argv = _argv
        self.stdout = sys.stdout
        self.output = helpers.DevNull()
        self._game_loop_started = False
        Game.loop = _loop
        Game.STORE_FILE = store.name
        sys.stdout = self.output