~townsend/autopilot/fix-gcalctool-desktop-file

« back to all changes in this revision

Viewing changes to autopilot/testcase.py

  • Committer: CI bot
  • Author(s): Thomi Richards, Max Brustkern
  • Date: 2014-04-08 00:29:44 UTC
  • mfrom: (459.6.5 logger-privatization)
  • Revision ID: ps-jenkins@lists.canonical.com-20140408002944-hkq216cwlrrbg3k7
Make logger objects within autopilot private. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
except ImportError:
80
80
    HAVE_TRACEPOINT = False
81
81
 
82
 
 
83
 
logger = logging.getLogger(__name__)
 
82
_logger = logging.getLogger(__name__)
84
83
 
85
84
 
86
85
try:
113
112
    if HAVE_TRACEPOINT:
114
113
        tp.emit_test_started(test_id)
115
114
    else:
116
 
        logger.warning(
 
115
        _logger.warning(
117
116
            "No tracing available - install the python-autopilot-trace "
118
117
            "package!")
119
118
 
154
153
            self._app_snapshot = _get_process_snapshot()
155
154
            self.addCleanup(self._compare_system_with_app_snapshot)
156
155
        except RuntimeError:
157
 
            logger.warning(
 
156
            _logger.warning(
158
157
                "Process manager backend unavailable, application snapshot "
159
158
                "support disabled.")
160
159
 
252
251
         data is retrievable via this object.
253
252
 
254
253
        """
255
 
        logger.info(
 
254
        _logger.info(
256
255
            "Attempting to launch application '%s' with arguments '%s' as a "
257
256
            "normal process",
258
257
            application,
300
299
        """
301
300
        if isinstance(app_uris, (six.text_type, six.binary_type)):
302
301
            app_uris = [app_uris]
303
 
        logger.info(
 
302
        _logger.info(
304
303
            "Attempting to launch click application '%s' from click package "
305
304
            " '%s' and URIs '%s'",
306
305
            app_name if app_name is not None else "(default)",
333
332
        """
334
333
        if isinstance(uris, (six.text_type, six.binary_type)):
335
334
            uris = [uris]
336
 
        logger.info(
 
335
        _logger.info(
337
336
            "Attempting to launch application '%s' with URIs '%s' via "
338
337
            "upstart-app-launch",
339
338
            application_name,
412
411
        """
413
412
        if key in os.environ:
414
413
            def _undo_patch(key, old_value):
415
 
                logger.info(
 
414
                _logger.info(
416
415
                    "Resetting environment variable '%s' to '%s'",
417
416
                    key,
418
417
                    old_value
423
422
        else:
424
423
            def _remove_patch(key):
425
424
                try:
426
 
                    logger.info(
 
425
                    _logger.info(
427
426
                        "Deleting previously-created environment "
428
427
                        "variable '%s'",
429
428
                        key
430
429
                    )
431
430
                    del os.environ[key]
432
431
                except KeyError:
433
 
                    logger.warning(
 
432
                    _logger.warning(
434
433
                        "Attempted to delete environment key '%s' that doesn't"
435
434
                        "exist in the environment",
436
435
                        key
437
436
                    )
438
437
            self.addCleanup(_remove_patch, key)
439
 
        logger.info(
 
438
        _logger.info(
440
439
            "Setting environment variable '%s' to '%s'",
441
440
            key,
442
441
            value
567
566
        if _UInputTouchDevice._device is None:
568
567
            Touch.create()
569
568
    except Exception as e:
570
 
        logger.warning(
 
569
        _logger.warning(
571
570
            "Failed to create Touch device for bug lp:1297595 workaround: "
572
571
            "%s" % str(e)
573
572
        )