Skip to content

Commit

Permalink
Disable logging for test_unittests
Browse files Browse the repository at this point in the history
Test suite: None
Test baseline: N/A
Test namelist changes: N/A
Test status: N/A

Fixes: None

User interface changes?: No

Code review: None
  • Loading branch information
billsacks committed Aug 11, 2016
1 parent 84c01b0 commit 72bc74a
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions utils/python/tests/scripts_regression_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,24 @@ def test_unittests(self):
# This is analogous to running:
# python -m unittest discover
#
# It seems kind of funny to run a bunch of other unit test suites from
# within this single unit test, but doing it this way makes it
# consistent with how we run other tests in this module.
# Yes, that means we have a bunch of unit tests run from this one unit
# test.

testsuite = unittest.defaultTestLoader.discover(
start_dir = LIB_DIR,
pattern = 'test*.py')

testrunner = unittest.TextTestRunner(buffer=False)

results = testrunner.run(testsuite)
# Disable logging; otherwise log messages written by code under test
# clutter the unit test output
log_lvl = logging.getLogger().getEffectiveLevel()
logging.disable(logging.CRITICAL)
try:
results = testrunner.run(testsuite)
finally:
logging.getLogger().setLevel(log_lvl)

self.assertTrue(results.wasSuccessful())

def test_CIME_doctests(self):
Expand Down

0 comments on commit 72bc74a

Please sign in to comment.