On 9/24/2014 3:33 PM, Milson Munakami wrote:
I am learning to use unittest with python
[way too long example]
File "TestTest.py", line 44
def cleanup(self, success):
^
SyntaxError: invalid syntax
A common recommendation is to find the *minimal* example that exhibits
the problem. (Start with commenting out everything after the code in
the traceback, then at least half the code before it. Etc.) That means
that removing or commenting out a single statememt and the problem
disappears. In compound statements, you may need to insert 'pass' to
not create a new problem.
If you had done that, you would have reduced your code to something like
class testFirewall( unittest.TestCase ):
def tearDown(self):
if self.reportStatus_:
self.log.info("=== Test %s completed normally (%d sec)", self.name_,
duration
def cleanup(self, success):
sys.excepthook = sys.__excepthook__
At that point, replacing "self.log.info(..." with "pass" would have made
it clear that the problem was with the replaced statement.
--
Terry Jan Reedy
--
https://mail.python.org/mailman/listinfo/python-list