[Visualpython-discuss] Unittests don't run with debug
by Robert Ferrell other posts by this author
Nov 6 2003 10:49PM messages near this date
view in the new Beta List Site
Re: [Visualpython-discuss] trouble debugging example with visual python
|
Re: [Visualpython-discuss] Unittests don't run with debug
I'm using PyUnit (unittest) for testing. When I run with debugging the
tests do not run. If I choose "Start Without Debugging" the tests run
fine. What gives?
thanks,
-robert
Here's a script that shows the problem. Put this into a Visual Studio
project and choose "Debug|Start". Then "Debug|Start Without Debugging".
In the first case, test does not run (an error), in the second case test
does run.
====testTest.py====
"""
Toy example showing problem when using unittest in Visual Python.
When run with the debugger, test does not run. When run without debugging,
test is run properly. To see the problem, in Visual Studio/Visual Python,
1. Choose Debug|Start, and notice "Ran 0 tests"
2. Choose Debug|Start Without Debugging, and notice "Ran 1 test"
"""
import unittest
class Test_1(unittest.TestCase):
"""Will print 'Test Ran' if successful."""
def test_it(self):
"""If you see this message, the test ran."""
print 'Test Ran'
if (__name__ == '__main__'):
print 'Should see "Ran 1 test", but with debug will see "Ran 0 tests".'
unittest.main()
Thread:
Robert Ferrell
Eric Promislow
Robert Ferrell
Robert Ferrell
|