def test_context(self): r = Runner() r.args.tests = ['typ.tests.runner_test.ContextTests'] r.context = {'foo': 'bar'} r.setup_fn = _setup_process r.teardown_fn = _teardown_process r.win_multiprocessing = WinMultiprocessing.importable ret, _, _ = r.run() self.assertEqual(ret, 0)
def test_context(self): r = Runner() r.args.tests = ['typ.tests.runner_test.ContextTests'] r.context = {'foo': 'bar'} r.setup_fn = _setup_process r.teardown_fn = _teardown_process r.win_multiprocessing = WinMultiprocessing.importable ret, _, _ = r.run() self.assertEqual(ret, 0)
def test_exception_in_teardown(self): r = Runner() r.args.tests = ['typ.tests.runner_test.ContextTests'] r.context = {'foo': 'bar'} r.setup_fn = _setup_process r.teardown_fn = _teardown_throws r.win_multiprocessing = WinMultiprocessing.importable ret, _, _ = r.run() self.assertEqual(ret, 0) self.assertEqual(r.final_responses[0][2].message, 'exception in teardown')
def test_exception_in_teardown(self): r = Runner() r.args.tests = ['typ.tests.runner_test.ContextTests'] r.context = {'foo': 'bar'} r.setup_fn = _setup_process r.teardown_fn = _teardown_throws r.win_multiprocessing = WinMultiprocessing.importable ret, _, _ = r.run() self.assertEqual(ret, 0) self.assertEqual(r.final_responses[0][2].message, 'exception in teardown')
def call(self, argv, platform=None, win_multiprocessing=None, **kwargs): h = self.make_host() orig_wd = h.getcwd() tmpdir = None try: tmpdir = h.mkdtemp() h.chdir(tmpdir) h.capture_output() if platform is not None: h.platform = platform r = Runner(h) if win_multiprocessing is not None: r.win_multiprocessing = win_multiprocessing ret = r.main(argv, **kwargs) finally: out, err = h.restore_output() h.chdir(orig_wd) if tmpdir: h.rmtree(tmpdir) return ret, out, err
def call(self, argv, platform=None, win_multiprocessing=None, **kwargs): h = self.make_host() orig_wd = h.getcwd() tmpdir = None try: tmpdir = h.mkdtemp() h.chdir(tmpdir) h.capture_output() if platform is not None: h.platform = platform r = Runner(h) if win_multiprocessing is not None: r.win_multiprocessing = win_multiprocessing ret = r.main(argv, **kwargs) finally: out, err = h.restore_output() h.chdir(orig_wd) if tmpdir: h.rmtree(tmpdir) return ret, out, err