<commit_before>import os
import mock
import time
import unittest

from nose.plugins.attrib import attr

import uuid
from datetime import datetime
from openquake.engine.performance import \
    PerformanceMonitor, EnginePerformanceMonitor, LightMonitor
from openquake.engine.db.models import Performance
from openquake.engine import engine

flush = EnginePerformanceMonitor.cache.flush


class TestCase(unittest.TestCase):

    def _check_result(self, pmon):
        # check that the attributes start_time, duration and mem are populated
        self.assertGreater(datetime.now(), pmon.start_time)
        self.assertGreaterEqual(pmon.duration, 0)
        self.assertGreaterEqual(pmon.mem[0], 0)

    # the base monitor does not save on the engine db
    @attr('slow')
    def test_performance_monitor(self):
        ls = []
        with PerformanceMonitor([os.getpid()]) as pmon:
            for _ in range(1000 * 1000):
                ls.append(range(50))  # 50 million of integers
        self._check_result(pmon)

    def test_light_monitor(self):
        mon = LightMonitor('test', 1)
        with mon:
            time.sleep(.1)<commit_msg>Removed test on the PerformanceMonitor that should not be here<commit_after>import os
import mock
import time
import unittest

from nose.plugins.attrib import attr

import uuid
from datetime import datetime
from openquake.engine.performance import \
    PerformanceMonitor, EnginePerformanceMonitor, LightMonitor
from openquake.engine.db.models import Performance
from openquake.engine import engine

flush = EnginePerformanceMonitor.cache.flush


class TestCase(unittest.TestCase):

    def _check_result(self, pmon):
        # check that the attributes start_time, duration and mem are populated
        self.assertGreater(datetime.now(), pmon.start_time)
        self.assertGreaterEqual(pmon.duration, 0)
        self.assertGreaterEqual(pmon.mem[0], 0)

    def test_light_monitor(self):
        mon = LightMonitor('test', 1)
        with mon:
            time.sleep(.1)
{'fraction_non_alphanumeric': 0.07677067855373948, 'fraction_numerical': 0.010896483407627538, 'mean_word_length': 3.539325842696629, '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': '2135255', 'n_tokens_mistral': 587, 'n_tokens_neox': 548, 'n_words': 162}