Exemple #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()
Exemple #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()
Exemple #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())
Exemple #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())
Exemple #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()
Exemple #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()