telemetry.decorators | index telemetry/decorators.py

`# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# pylint: disable=W0212`

Modules
`` |  |

datetime functools | inspect os | types warnings |

Classes
`` |  |

__builtin__.object
  Deprecated

class Deprecated(__builtin__.object)
`` |  | Methods defined here:

__call__(self, target)

__init__(self, year, month, day, extra_guidance='')

Data descriptors defined here:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

Functions
`` |  |

Cache(obj)
  `Decorator for caching read-only properties.
  Example usage (always returns the same Foo instance):
  @Cache
  def CreateFoo():
  return Foo()
  If CreateFoo() accepts parameters, a separate cached value is maintained
  for each unique parameter combination.
  Cached methods maintain their cache for the lifetime of the /instance/, while
  cached functions maintain their cache for the lifetime of the /module/.`

Disabled(*args)
  `Decorator for disabling tests/benchmarks.
  If args are given, the test will be disabled if ANY of the args match the
  browser type, OS name or OS version:
  @Disabled('canary') # Disabled for canary browsers
  @Disabled('win') # Disabled on Windows.
  @Disabled('win', 'linux') # Disabled on both Windows and Linux.
  @Disabled('mavericks') # Disabled on Mac Mavericks (10.9) only.
  @Disabled('all') # Unconditionally disabled.`

Enabled(*args)
  `Decorator for enabling tests/benchmarks.
  The test will be enabled if ANY of the args match the browser type, OS name
  or OS version:
  @Enabled('canary') # Enabled only for canary browsers
  @Enabled('win') # Enabled only on Windows.
  @Enabled('win', 'linux') # Enabled only on Windows or Linux.
  @Enabled('mavericks') # Enabled only on Mac Mavericks (10.9).`

IsEnabled(test, possible_browser)
  `Returns True iff |test| is enabled given the |possible_browser|.
  Use to respect the @Enabled / @Disabled decorators.
  Args:
  test: A function or class that may contain _disabled_strings and/or
  _enabled_strings attributes.
  possible_browser: A PossibleBrowser to check whether |test| may run against.`

Isolated(*args)
  `Decorator for noting that tests must be run in isolation.
  The test will be run by itself (not concurrently with any other tests)
  if ANY of the args match the browser type, OS name, or OS version.`

ShouldBeIsolated(test, possible_browser)

ShouldSkip(test, possible_browser)
  `Returns whether the test should be skipped and the reason for it.`