Hi all,
I just pushed a fix to a test failure on Oracle -- the last-executed-query
test. However, I want to ask about the preferred style in writing the test
itself. The test, as it is written now, is:
def test_last_executed_query(self):
"""
last_executed_query should not raise an exception even if no previous
query has been run.
"""
cursor = connection.cursor()
try:
connection.ops.last_executed_query(cursor, '', ())
except Exception:
self.fail("'last_executed_query' should not raise an exception.")
I find that "try..except" distasteful: if the test is written simply as
def test_last_executed_query(self):
"""
last_executed_query should not raise an exception even if no previous
query has been run.
"""
cursor = connection.cursor()
connection.ops.last_executed_query(cursor, '', ())
then it checks exactly the same thing, but when it fails, it prints the
exception instead of just saying there was one -- which is much more useful.
The only downside I see is, this is reported as an Error rather than a
Failure; but personally, I don't think that matters.
Comments? Any reason not to change it?
Thanks,
Shai.
--
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.