# Path: tests/util.py
# def log_config(level=logging.DEBUG):
#     """
#     Configure logging.
#     Hackily colors log output if 'colorlog' is installed.
#     See: https://pypi.python.org/pypi/colorlog/
#     """
# 
#     format  = ("%(asctime)s %(levelname)-8s [%(name)s]  %(message)s")
#     cformat = ("%(bg_black)s%(asctime)s "+
#         "%(log_color)s%(levelname)-8s [%(name)-50s] %(reset)s "+
#         "%(log_color)s%(bold)s%(message)s")
# 
#     def color_if_possible():
#         try:
#             from colorlog import ColoredFormatter
#         except ImportError:
#             return  # optional lib not available, so don't color
#         formatter = ColoredFormatter(cformat)
#         logging.getLogger().handlers[0].formatter = formatter
# 
#     logging.basicConfig(level=level, format=format)
#     color_if_possible()
# 
# def load_metset(asset):
#     """Helper to load test asset and parse as MetSet, returning."""
#     yaml_metset1 = load_test_asset(asset)
#     parser1 = mdefl.MetSetParser()
#     return parser1.parse_ystr_metset(yaml_metset1)
# 
# def load_queryset(asset):
#     """Helper to load test asset and parse as QuerySet, returning."""
#     yaml_queryset1 = load_test_asset(asset)
#     parser1 = mql.QuerySetParser()
#     return parser1.parse_ystr_queryset(yaml_queryset1)


import pytest
import logging
import json
import axonchisel.metrics.io.erout.plugins.ero_geckoboard as ero_geckoboard
from axonchisel.metrics.run.servant.config import ServantConfig
from axonchisel.metrics.run.servant.request import ServantRequest
from axonchisel.metrics.run.servant.state import ServantState
from axonchisel.metrics.run.servant.servant import Servant
from .util import log_config, load_metset, load_queryset
# ----------------------------------------------------------------------------


def setup_module(module):
    log_config(level=logging.INFO)
    # log_config(level=logging.DEBUG)


# ----------------------------------------------------------------------------


class TestEROut_geckoboard(object):
    """
    Test general EROut.
    """

    #
    # Setup / Teardown
    #

    def setup_method(self, method):
        self.jout = dict()
        self.emfetch_extinfo = {
        }
        self.erout_extinfo = {
            '_default': {
                'jout': self.jout,
            }
        }
        self.metset1 = load_metset( 'mqe-metset1.yml' )

# Path: tests/util.py
# def log_config(level=logging.DEBUG):
#     """
#     Configure logging.
#     Hackily colors log output if 'colorlog' is installed.
#     See: https://pypi.python.org/pypi/colorlog/
#     """
# 
#     format  = ("%(asctime)s %(levelname)-8s [%(name)s]  %(message)s")
#     cformat = ("%(bg_black)s%(asctime)s "+
#         "%(log_color)s%(levelname)-8s [%(name)-50s] %(reset)s "+
#         "%(log_color)s%(bold)s%(message)s")
# 
#     def color_if_possible():
#         try:
#             from colorlog import ColoredFormatter
#         except ImportError:
#             return  # optional lib not available, so don't color
#         formatter = ColoredFormatter(cformat)
#         logging.getLogger().handlers[0].formatter = formatter
# 
#     logging.basicConfig(level=level, format=format)
#     color_if_possible()
# 
# def load_metset(asset):
#     """Helper to load test asset and parse as MetSet, returning."""
#     yaml_metset1 = load_test_asset(asset)
#     parser1 = mdefl.MetSetParser()
#     return parser1.parse_ystr_metset(yaml_metset1)
# 
# def load_queryset(asset):
#     """Helper to load test asset and parse as QuerySet, returning."""
#     yaml_queryset1 = load_test_asset(asset)
#     parser1 = mql.QuerySetParser()
#     return parser1.parse_ystr_queryset(yaml_queryset1)


# Path: tests/test_erout_geckoboard.py
import pytest
import logging
import json
import axonchisel.metrics.io.erout.plugins.ero_geckoboard as ero_geckoboard
from axonchisel.metrics.run.servant.config import ServantConfig
from axonchisel.metrics.run.servant.request import ServantRequest
from axonchisel.metrics.run.servant.state import ServantState
from axonchisel.metrics.run.servant.servant import Servant
from .util import log_config, load_metset, load_queryset

# ----------------------------------------------------------------------------


def setup_module(module):
    log_config(level=logging.INFO)
    # log_config(level=logging.DEBUG)


# ----------------------------------------------------------------------------


class TestEROut_geckoboard(object):
    """
    Test general EROut.
    """

    #
    # Setup / Teardown
    #

    def setup_method(self, method):
        self.jout = dict()
        self.emfetch_extinfo = {
        }
        self.erout_extinfo = {
            '_default': {
                'jout': self.jout,
            }
        }
        self.metset1 = load_metset( 'mqe-metset1.yml' )

        self.queryset1 = load_queryset( 'queryset2.yml' )