I'm using gaetestbed in my GAE app, and it's working very well. However, the useful statements that nose prints when your test is incorrect is being washed away by App Engine's logging:
root: Level 9: Evaling filter expression "datastore_types.Key.from_path(u'User', 85, _app=u'tipfy') == datastore_types.Key.from_path(u'User', 87, _app=u'tipfy')"
root: Level 9: Evaling filter expression "datastore_types.Key.from_path(u'User', 87, _app=u'tipfy') == datastore_types.Key.from_path(u'User', 87, _app=u'tipfy')"
root: Level 9: Evaling filter expression "datastore_types.Key.from_path(u'User', 86, _app=u'tipfy') == datastore_types.Key.from_path(u'User', 87, _app=u'tipfy')"
root: Level 9: Evaling filter expression "datastore_types.Key.from_path(u'User', 87, _app=u'tipfy') == datastore_types.Key.from_path(u'User', 87, _app=u'tipfy')"
--------------------- >> end captured logging << ---------------------
----------------------------------------------------------------------
Ran 28 tests in 3.605s
Is there a way to suppress this so I can get the clean something != something else
error messages only?
Not sure that this will work in gaetestbed, but using django-nose I can add the following to my settings.py:
NOSE_ARGS = ['--logging-clear-handlers', '--logging-filter=-root']
Another work-around is to just inverse grep the output:
./manage.py test 2>&1 | egrep -v "^(root|Level)"
Here is a stupid way,
find capture.py and logcapture.py in your nose/plugins/
find function addCaptureToErr
in both files, then revise it.
(I don't know which one is the right one, please test yourself)
original code should look like this:
def addCaptureToErr(self, ev, output):
return '\n'.join([str(ev) , ln('>> begin captured stdout <<'),
output, ln('>> end captured stdout <<')])
change it into
def addCaptureToErr(self, ev, output):
check_errmsgs(output)
return '\n'.join([str(ev) , ln('>> begin captured stdout <<'),
output, ln('>> end captured stdout <<')])
def check_errmsgs(self,errmsgs):
for i in range(len(errmsgs)-1,-1,-1):
item = errmsgs[i].split(":")
if(item[2].find("Evaling filter expression")):
#find msgs you want to ignore
del errmsgs[i]
It should works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With