<commit_before>from metadatastore.examples.sample_data.common import apply_deadband, noisy
from metadatastore.examples.sample_data import (temperature_ramp,
                                                multisource_event)
from .utils import mds_setup, mds_teardown
import numpy as np
import itertools
import pytest


def setup_function(function):
    mds_setup()


def teardown_function(function):
    mds_teardown()


def test_bad_deadbands():
    # the -1 should throw a ValueError
    with pytest.raises(ValueError):
        apply_deadband(None, -1)


@pytest.mark.parametrize('v', [0, np.arange(0, 5)])
def test_noisy_for_smoke(v):
    noisy(v)


@pytest.mark.parametrize(
    'failing_time, mod',
    itertools.product([-1, 1], [temperature_ramp, multisource_event])
)
def test_sleepy_failures(failing_time, mod):
    with pytest.raises(NotImplementedError):
        mod.run(sleep=failing_time)


def test_multisource_event():
    multisource_event.run()


def test_temperature_ramp():
    temperature_ramp.run()<commit_msg>TST: setup database on a per-module basis<commit_after>from metadatastore.examples.sample_data.common import apply_deadband, noisy
from metadatastore.examples.sample_data import (temperature_ramp,
                                                multisource_event)
from .utils import mds_setup, mds_teardown
import numpy as np
import itertools
import pytest


def setup_module(module):
    mds_setup()


def teardown_module(module):
    mds_teardown()


def test_bad_deadbands():
    # the -1 should throw a ValueError
    with pytest.raises(ValueError):
        apply_deadband(None, -1)


@pytest.mark.parametrize('v', [0, np.arange(0, 5)])
def test_noisy_for_smoke(v):
    noisy(v)


@pytest.mark.parametrize(
    'failing_time, mod',
    itertools.product([-1, 1], [temperature_ramp, multisource_event])
)
def test_sleepy_failures(failing_time, mod):
    with pytest.raises(NotImplementedError):
        mod.run(sleep=failing_time)


def test_multisource_event():
    multisource_event.run()


def test_temperature_ramp():
    temperature_ramp.run()
{'fraction_non_alphanumeric': 0.09798270893371758, 'fraction_numerical': 0.0067243035542747355, 'mean_word_length': 3.9595238095238097, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2750203', 'n_tokens_mistral': 735, 'n_tokens_neox': 720, 'n_words': 139}