cannot print debug messages in tests (trivial)

Bug #1181925 reported by Ryota Mibu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Low
Ryota Mibu

Bug Description

We cannot get debug messages in the most unit tests that use BaseTestCase in quantum/tests/base.py .
In BaseTestCase, fixtures.FakeLogger was used with its default logging level (INFO) instead of quantum/openstack logger.
So, even though setting debug=True in quantum/tests/etc/quantum.conf.test , we cannot get DEBUG messages.

I think it is useful that there is a option to show DEBUG messages in those unit tests, especially when you run individual tests for debugging.
# The default should be kept in INFO, because I got over 80MB output by "tox -e py27" with setting FakeLogger level to DEBUG.

Tags: unittest
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to quantum (master)

Fix proposed to branch: master
Review: https://review.openstack.org/29742

Changed in quantum:
assignee: nobody → Ryota Mibu (r-mibu)
status: New → In Progress
Changed in quantum:
importance: Undecided → Low
milestone: none → havana-1
milestone: havana-1 → havana-2
Revision history for this message
yong sheng gong (gongysh) wrote :

Can u give me a case to verify your code?
I cannot find difference by running tox -e py27 quantum.tests.unit.test_dhcp_agent with OS_DEBUG=1

Revision history for this message
Ryota Mibu (r-mibu) wrote :

Check .testrepository/<id> . All test logs are put into that file.

I tested by running the following commands:
  $ OS_DEBUG=1 tox -e py27 quantum.tests.unit.test_dhcp_agent
     ...snip...
  PASSED (id=78)
     ...snip...
  $ OS_DEBUG=0 tox -e py27 quantum.tests.unit.test_dhcp_agent
     ...snip...
  PASSED (id=79)
     ...snip...
  $ tox -e py27 quantum.tests.unit.test_dhcp_agent
     ...snip...
  PASSED (id=80)
     ...snip...

I can find DEBUG messages:
  $ grep -c "DEBUG" .testrepository/{78,79,80}
  .testrepository/78:68
  .testrepository/79:0
  .testrepository/80:0

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to quantum (master)

Reviewed: https://review.openstack.org/29742
Committed: http://github.com/openstack/quantum/commit/a9560a9cc03c2d00ba5db4f28eb9405aa854b5a6
Submitter: Jenkins
Branch: master

commit a9560a9cc03c2d00ba5db4f28eb9405aa854b5a6
Author: Ryota MIBU <email address hidden>
Date: Mon May 20 14:36:39 2013 +0900

    Make logging level in unit tests configurable.

    Added a debug option to unittest(BaseTestCase) which sets logging level of
    fixtures.FakeLogger to DEBUG. To enable this option, set OS_DEBUG=True or
    OS_DEBUG=1 in environment variables.

    Fixes: bug #1181925
    Change-Id: Id09008ddabb837290edf12e1cbd014dc74760113

Changed in quantum:
status: In Progress → Fix Committed
Changed in quantum:
milestone: havana-2 → havana-1
Thierry Carrez (ttx)
Changed in quantum:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: havana-1 → 2013.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.