title: Verify the error code or message from SystemExit in pytest
body: <p>According to the pytest documentation, I can assert that a SystemExit() occurs, but I want to do more: I also want to verify the exit code and any messages. I tried the below code, but nothing prints and I'm not sure what I would need to assert to prove that I got the right error code.</p>
  
  <pre><code>    with pytest.raises(SystemExit):
          docopt_args = validate_args(docopt_args)
          out, err = pytest.capsys.readouterr()
          assert out == 'Foo'
          print out, err
  </code></pre>
  
  <p>When I run my test, it passes, but that is it. Nothing is printed and I don't get an assert error. </p>
  
  <p>The code I expect to be executed is:</p>
  
  <pre><code>        print '\n' + docopt_args['-d'] + ' is not a valid date\n'
          sys.exit(-3)
  </code></pre>