# Path: wa/framework/exception.py
# class ConfigError(WAError):
#     """Raised when configuration provided is invalid. This error suggests that
#     the user should modify their config and try again."""
# 
# Path: wa/utils/serializer.py
# class yaml(object):
# 
#     @staticmethod
#     def dump(o, wfh, *args, **kwargs):
#         return _yaml.dump(o, wfh, *args, **kwargs)
# 
#     @staticmethod
#     def load(fh, *args, **kwargs):
#         try:
#             return _yaml.load(fh, *args, Loader=_WaYamlLoader, **kwargs)
#         except _yaml.YAMLError as e:
#             lineno = None
#             if hasattr(e, 'problem_mark'):
#                 lineno = e.problem_mark.line  # pylint: disable=no-member
#             message = e.args[0] if (e.args and e.args[0]) else str(e)
#             raise SerializerSyntaxError(message, lineno)
# 
#     loads = load


import os
import sys
from collections import defaultdict
from unittest import TestCase
from nose.tools import assert_equal, assert_in, raises, assert_true
from wa.framework.configuration.execution import ConfigManager
from wa.framework.configuration.parsers import AgendaParser
from wa.framework.exception import ConfigError
from wa.utils.serializer import yaml
from wa.utils.types import reset_all_counters
        from pprint import pprint
            raise Exception('ConfigError was not raised for an agenda with duplicate ids.')

    def test_yaml_missing_field(self):
        invalid_agenda = yaml.load(invalid_agenda_text)

        try:
            self.parser.load(self.config, invalid_agenda, 'test')
        except ConfigError as e:
            assert_in('workload name', e.message)
        else:
            raise Exception('ConfigError was not raised for an invalid agenda.')

    def test_defaults(self):
        short_agenda = yaml.load(short_agenda_text)
        self.parser.load(self.config, short_agenda, 'test')

        workload_entries = self.config.jobs_config.root_node.workload_entries
        assert_equal(len(workload_entries), 3)
        assert_equal(workload_entries[0].config['workload_name'], 'antutu')
        assert_equal(workload_entries[0].id, 'wk1')

    def test_default_id_assignment(self):
        default_ids_agenda = yaml.load(default_ids_agenda_text)

        self.parser.load(self.config, default_ids_agenda, 'test2')
        workload_entries = self.config.jobs_config.root_node.workload_entries
        assert_equal(workload_entries[0].id, 'wk2')
        assert_equal(workload_entries[3].id, 'wk3')

    def test_sections(self):

# Path: wa/framework/exception.py
# class ConfigError(WAError):
#     """Raised when configuration provided is invalid. This error suggests that
#     the user should modify their config and try again."""
# 
# Path: wa/utils/serializer.py
# class yaml(object):
# 
#     @staticmethod
#     def dump(o, wfh, *args, **kwargs):
#         return _yaml.dump(o, wfh, *args, **kwargs)
# 
#     @staticmethod
#     def load(fh, *args, **kwargs):
#         try:
#             return _yaml.load(fh, *args, Loader=_WaYamlLoader, **kwargs)
#         except _yaml.YAMLError as e:
#             lineno = None
#             if hasattr(e, 'problem_mark'):
#                 lineno = e.problem_mark.line  # pylint: disable=no-member
#             message = e.args[0] if (e.args and e.args[0]) else str(e)
#             raise SerializerSyntaxError(message, lineno)
# 
#     loads = load


# Path: tests/test_agenda_parser.py
import os
import sys
from collections import defaultdict
from unittest import TestCase
from nose.tools import assert_equal, assert_in, raises, assert_true
from wa.framework.configuration.execution import ConfigManager
from wa.framework.configuration.parsers import AgendaParser
from wa.framework.exception import ConfigError
from wa.utils.serializer import yaml
from wa.utils.types import reset_all_counters
        from pprint import pprint

            raise Exception('ConfigError was not raised for an agenda with duplicate ids.')

    def test_yaml_missing_field(self):
        invalid_agenda = yaml.load(invalid_agenda_text)

        try:
            self.parser.load(self.config, invalid_agenda, 'test')
        except ConfigError as e:
            assert_in('workload name', e.message)
        else:
            raise Exception('ConfigError was not raised for an invalid agenda.')

    def test_defaults(self):
        short_agenda = yaml.load(short_agenda_text)
        self.parser.load(self.config, short_agenda, 'test')

        workload_entries = self.config.jobs_config.root_node.workload_entries
        assert_equal(len(workload_entries), 3)
        assert_equal(workload_entries[0].config['workload_name'], 'antutu')
        assert_equal(workload_entries[0].id, 'wk1')

    def test_default_id_assignment(self):
        default_ids_agenda = yaml.load(default_ids_agenda_text)

        self.parser.load(self.config, default_ids_agenda, 'test2')
        workload_entries = self.config.jobs_config.root_node.workload_entries
        assert_equal(workload_entries[0].id, 'wk2')
        assert_equal(workload_entries[3].id, 'wk3')

    def test_sections(self):

        sectioned_agenda = yaml.load(sectioned_agenda_text)