pymssql/pymssql — pull request #172 by msabramo (2014-01-13 16:06:04+00:00)
Title: test_threaded.py: Refactor; check results & exceptions

I was about to work on converting this and the other tests over to py.test (which I think will be nicer than nosetests, because the config stuff that we're doing in the custom nose plugin can be done in a py.test `conftest.py` and then we wouldn't have to have stuff to install the nose plugin or be forced to invoke `python setup.py develop` in tox, etc.) Anyways before converting this over, I noticed a few things that could be refactored... And then a few more...

My goals:

1. Make code more readable/maintainable by factoring out common code, using new `helpers.StoredProc class`, using `with` statement, etc. Hopefully, the code is more succint now and it's easier to tell what it does.

2. Check that results and exceptions are as expected. While refactoring, I noticed that the existing code was swallowing pretty much all exceptions and so you could easily introduce an egregious error and the tests would still pass. So I wanted to not swallow all exceptions, make stronger assertions about the exceptions being raised, and make some assertions about the results coming back from the threads.

Cc: @rsyring, @damoxc, @ramiro