jazzband / django-nose

Django test runner using nose
http://pypi.python.org/pypi/django-nose
BSD 3-Clause "New" or "Revised" License
882 stars 234 forks source link

LogCapture defaults to DEBUG and changes all output during testing. #158

Open rrauenza opened 10 years ago

rrauenza commented 10 years ago

I'm not sure what the intended behavior is. One problem is django nose seems to output all logging commands to the console during test. I need to find a fix for that as well.

But what I found is when I upgraded nose, LogCapture sets the default logging level to 0 at the root logger. Is this the intended behavior? Or should the logcapture level be only set for the specific logcapture handler?

(relevant code:

/perfcat/pcat/virtualenv/lib/python2.7/site-packages/nose/plugins/logcapture.py(195)setupLoghandler() 194 loglevel = getattr(self, "loglevel", "NOTSET") --> 195 root_logger.setLevel(getattr(logging, loglevel)) 196 )

Before:

ipdb> import logging_tree
ipdb> logging_tree.printout()
<--""
   Level WARNING
   Handler Stream <open file '<stderr>', mode 'w' at 0x7f290ef00270>
   Handler <nose.plugins.logcapture.MyMemoryHandler object at 0x27f7e50>
   |
   o<--"celery"
   |   Handler <kombu.log.NullHandler object at 0xc35950>
   |   |
   |   o<--"celery.task"
   |       Handler <kombu.log.NullHandler object at 0xc35ad0>
   |
   o<--"django"
   |   Handler <logging.NullHandler object at 0x1693850>
   |   |
   |   o<--[django.db]
   |   |   |
   |   |   o<--"django.db.backends"
   |   |
   |   o<--"django.request"
   |       Level ERROR
   |       Handler <django.utils.log.AdminEmailHandler object at 0x1693950>
[...]

After:

ipdb> logging_tree.printout()
<--""
   Handler Stream <open file '<stderr>', mode 'w' at 0x7f290ef00270>
   Handler <nose.plugins.logcapture.MyMemoryHandler object at 0x27f7e50>
   |
   o<--"celery"
   |   Handler <kombu.log.NullHandler object at 0xc35950>
   |   |
   |   o<--"celery.task"
   |       Handler <kombu.log.NullHandler object at 0xc35ad0>
   |
   o<--"django"
[...]
jwhitlock commented 9 years ago

Might be same issue as #160