示例#1
0
def test_fatal_status():
  out = StringIO()
  with pytest.raises(SystemExit) as pytest_wrapped_e:
    io.fatal("foo", file=out, status=10)
  # Check specified return code.
  assert pytest_wrapped_e.value.code == 10
  assert "fatal: foo\n" == out.getvalue()
示例#2
0
def test_fatal():
  out = StringIO()
  with pytest.raises(SystemExit) as pytest_wrapped_e:
    io.fatal("foo", file=out)
  # Check default return code.
  assert pytest_wrapped_e.value.code == 1
  assert "fatal: foo\n" == out.getvalue()
示例#3
0
 def test_fatal_status(self):
     out = StringIO()
     with self.assertRaises(SystemExit) as ctx:
         io.fatal("foo", file=out, status=10)
     # Check specified return code.
     self.assertEqual(ctx.exception.code, 10)
     self._test("fatal: foo\n", out.getvalue())
示例#4
0
 def test_fatal(self):
     out = StringIO()
     with self.assertRaises(SystemExit) as ctx:
         io.fatal("foo", file=out)
     # Check default return code.
     self.assertEqual(ctx.exception.code, 1)
     self._test("fatal: foo\n", out.getvalue())
示例#5
0
def test_fatal_status():
    out = StringIO()
    with pytest.raises(SystemExit) as pytest_wrapped_e:
        io.fatal("foo", file=out, status=10)
    # Check specified return code.
    assert pytest_wrapped_e.value.code == 10
    assert "fatal: foo\n" == out.getvalue()
示例#6
0
def test_fatal():
    out = StringIO()
    with pytest.raises(SystemExit) as pytest_wrapped_e:
        io.fatal("foo", file=out)
    # Check default return code.
    assert pytest_wrapped_e.value.code == 1
    assert "fatal: foo\n" == out.getvalue()