<commit_before># 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.

import logging
import time
import unittest

from telemetry import decorators
from telemetry.internal.platform.power_monitor import msr_power_monitor
from telemetry.internal.platform import win_platform_backend


class MsrPowerMonitorTest(unittest.TestCase):
  @decorators.Enabled('xp', 'win7', 'win8')  # http://crbug.com/479337
  def testMsrRuns(self):
    platform_backend = win_platform_backend.WinPlatformBackend()
    power_monitor = msr_power_monitor.MsrPowerMonitorWin(platform_backend)
    if not power_monitor.CanMonitorPower():
      logging.warning('Test not supported on this platform.')
      return

    power_monitor.StartMonitoringPower(None)
    time.sleep(0.01)
    statistics = power_monitor.StopMonitoringPower()

    self.assertEqual(statistics['identifier'], 'msr')
    self.assertIn('energy_consumption_mwh', statistics)
    self.assertGreater(statistics['energy_consumption_mwh'], 0)
<commit_msg>[Telemetry] Disable flaky MSR power monitor unit test.<commit_after># 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.

import logging
import time
import unittest

from telemetry import decorators
from telemetry.internal.platform.power_monitor import msr_power_monitor
from telemetry.internal.platform import win_platform_backend


class MsrPowerMonitorTest(unittest.TestCase):
  @decorators.Disabled('all') # http://crbug.com/712486
  #@decorators.Enabled('xp', 'win7', 'win8')  # http://crbug.com/479337
  def testMsrRuns(self):
    platform_backend = win_platform_backend.WinPlatformBackend()
    power_monitor = msr_power_monitor.MsrPowerMonitorWin(platform_backend)
    if not power_monitor.CanMonitorPower():
      logging.warning('Test not supported on this platform.')
      return

    power_monitor.StartMonitoringPower(None)
    time.sleep(0.01)
    statistics = power_monitor.StopMonitoringPower()

    self.assertEqual(statistics['identifier'], 'msr')
    self.assertIn('energy_consumption_mwh', statistics)
    self.assertGreater(statistics['energy_consumption_mwh'], 0)

{'fraction_non_alphanumeric': 0.08805579773321709, 'fraction_numerical': 0.016564952048823016, 'mean_word_length': 5.392757660167131, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4116088', 'n_tokens_mistral': 687, 'n_tokens_neox': 657, 'n_words': 165}