Rust hg currently has some test failures around exit handling.
This commit establishes some centralized tests around exit handling so
that we can unify the behavior of our Rust frontend and python.
There are some added tests that use a value other than an integer
or None for the exit code. The docs for sys.exit() say such a value
is allowed. However, Mercurial currently crashes in this case. Upcoming
commits will teach Mercurial to handle these values.
This does introduce a few Python 3 test failures. However, this test
already has a few failures. And the failures being introduced should
mostly go away with subsequent commits. So I think this is acceptable.