Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(597)

Unified Diff: tools/telemetry/telemetry/unittest/run_tests.py

Issue 23458027: Restore logging level after test is finished. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/unittest/run_tests.py
diff --git a/tools/telemetry/telemetry/unittest/run_tests.py b/tools/telemetry/telemetry/unittest/run_tests.py
index f38348f066da61d5d810023ac243236dfec1e962..fd9f0174668e5f1f836a701f44818f3771b84732 100644
--- a/tools/telemetry/telemetry/unittest/run_tests.py
+++ b/tools/telemetry/telemetry/unittest/run_tests.py
@@ -82,6 +82,9 @@ def DiscoverAndRunTests(
def Main(args, start_dir, top_level_dir, runner=None):
"""Unit test suite that collects all test cases for telemetry."""
+ # Cache the current logging level, this needs to be done before calling
+ # parser.parse_args, which changes logging level based on verbosity setting.
+ logging_level = logging.getLogger().getEffectiveLevel()
# Add unittest_data to the path so we can import packages from it.
util.AddDirToPythonPath(util.GetUnittestDataDir())
@@ -99,7 +102,6 @@ def Main(args, start_dir, top_level_dir, runner=None):
_, args = parser.parse_args(args)
- logging_level = logging.getLogger().getEffectiveLevel()
if default_options.verbosity == 0:
logging.getLogger().setLevel(logging.WARN)
@@ -129,8 +131,7 @@ def Main(args, start_dir, top_level_dir, runner=None):
return 0
finally:
options_for_unittests.Set(None, None)
- if default_options.verbosity == 0:
- # Restore logging level.
- logging.getLogger().setLevel(logging_level)
+ # Restore logging level, which may be changed in parser.parse_args.
+ logging.getLogger().setLevel(logging_level)
dtu 2013/09/12 21:45:51 Theoretically, you want this try/finally to go aro
dshi 2013/09/13 20:28:34 Done.
return 1
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698