Move sys.exit to outside main runner.
When stripping testify frames, make sure to include all non-testify frames.

Closes #177
Reformat the multiple-exception message.
there's no reason to run instance fixtures if class setup has failed.
fix test filtering regression in more-fair-bucketing
small tweaks to get tests passing under python -m testify.test_program test
Adds regression test for #227 Refs #226
Merge pull request #219 from dnephin/cleanup_testify_entry_point

Allow testify to be run programmatically

Previously testify's main entry point was the constructor of the
TestProgram class. This entry point also "returned" by calling
sys.exit(). This makes it impossible to call from other code.

I've moved the main entry point to test_program.main. It still calls
sys.exit() in main, but now you could call TestProgram().run() and
handle the response.

My use case here is an acceptance test suite that sets up a sandbox. I
would like to be able to setup the sandbox in a context manager around
testify. Something like this:

  with sandbox():
      result = TestProgram().run()
Merge pull request #221 from bukzor/skip_instance_setup_if_class_setup_fail

there's no reason to run instance fixtures if class setup has failed.

Closes #220

Instrumenting the "instance" setup/teardown in the case of class setup failure reveals the issue:
The test methods are not run, but the test instance setup/teardowns are run where the methods would have run.

  ========================================================================
  test.test_case_test ExceptionDuringClassSetupTest.test_child
  ------------------------------------------------------------
  Traceback (most recent call last):
    File "./test/test_case_test.py", line 440, in test_child
      assert_equal(expected, test_case.run_methods)
  AssertionError: assertion failed: l == r
  l: ['parent class_setup', 'child class_teardown', 'parent class_teardown']
  r: ['parent class_setup', 'parent setup', 'child teardown', 'parent teardown', 'parent setup', 'child teardown', 'parent teardown', 'child class_teard
  own', 'parent class_teardown']

  Diff:
  l: ['parent class_setup', 'child class_teardown', 'parent class_teardown']
  r: ['parent class_setup', 'parent setup', 'child teardown', 'parent teardown', 'parent setup', 'child teardown', 'parent teardown', 'child class_teard
  own', 'parent class_teardown']

  ========================================================================

  ========================================================================
  test.test_case_test ExceptionDuringClassSetupTest.test_parent
  ------------------------------------------------------------
  Traceback (most recent call last):
    File "./test/test_case_test.py", line 434, in test_parent
      assert_equal(expected, test_case.run_methods)
  AssertionError: assertion failed: l == r
  l: ['parent class_setup', 'parent class_teardown']
  r: ['parent class_setup', 'parent setup', 'parent teardown', 'parent class_teardown']

  Diff:
  l: ['parent class_setup', 'parent <>class_teardown']
  r: ['parent class_setup', 'parent <setup', 'parent teardown', 'parent >class_teardown']
Merge pull request #222 from bukzor/reformat_multiple_errors

Reformat the multiple-exception message.

We added multiple-exception support to testify recently, but I don't find
the output to be very readable or understandable. This patch refomats
them to match the python3.1 nested-exception support (see
http://docs.python.org/3.1/reference/simple_stmts.html#the-raise-statement).
Merge pull request #223 from bukzor/tracebacks_less_mangled

When stripping testify frames, make sure to include all non-testify
frames.
Closes #177

In my current test, the actual stack trace is this:

  File "/nail/home/buck/trees/Testify/testify/test_case.py", line 586, in __execute_block_recording_exceptions
    block_fxn()
  File "/usr/lib/python2.6/contextlib.py", line 16, in __enter__
    return self.gen.next()
  File "/nail/home/buck/trees/Testify/testify/test_case.py", line 371, in wrapper
    fixture()
  File "./yelp/testing/test_base_classes/mock_service_mixin.py", line 72, in setup_mock_services
    yelp.stubs.start_mocking()
  File "./yelp/stubs/__init__.py", line 239, in start_mocking
    mocked_stubs[key] = _make_mock_stub_name(val)
  File "./yelp/stubs/__init__.py", line 158, in _make_mock_stub_name
    assert 'yelp.testing' not in stub and '.Mock' not in stub
But testify prints it like so:

  Traceback (most recent call last):
    File "/usr/lib/python2.6/contextlib.py", line 16, in __enter__
      return self.gen.next()
  AssertionError

As you can see, all useful information has been stripped out. This is undesirable.
Merge pull request #226 from bukzor/fix_test_filtering

fix test filtering regression in more-fair-bucketing

The recent more-fair-bucketing branch caused testify to no longer filter
test cases when requested.
This fixes it.
Merge pull request #229 from bukzor/dash_em_fix

small tweaks to get tests passing under python -m testify.test_program
test

setuptools comes with pip, and everyone should have pip.
I don't believe we should ever use distutils, and we certainly don't
test for that case.
Merge pull request #230 from asottile/add_regression_test_227

Adds regression test for #227 Refs #226

Should fail on current master, will succeed with @bukzor 's patch in
 #226
Version 0.5.3