Пример #1
0
 def __init__(self):
     try:
         self._app = None
         self._args = CommandLineArguments()
         self._handle_dump_annotated()
         self._config = Config().load(self._get_config_paths())
         self._handle_dump_config()
         self._configure_logging()
     except ExitException:
         sys.exit(0)
Пример #2
0
class test_Config(unittest.TestCase):
    def setUp(self):
        self.config = Config()
        self.files = Files()

    def tearDown(self):
        self.files.delete()

    def test_load_default(self):
        self.config.load_default()
        self.assertIsInstance(self.config['assembly'], list)

    def test_load(self):
        self.files.write('f1', ("x: 1\n" "y: 2"))
        self.files.write('f2', ("x: 3\n" "z: 4"))

        self.config.load([self.files.path('f1'), self.files.path('f2')])
        self.assertEquals({'x': 3, 'y': 2, 'z': 4}, self.config)

    def test_classes_config(self):
        self.config.load_dict({
            'classes': {
                self.__class__.__module__ + '.' + self.__class__.__name__: {
                    'x': 4
                }
            }
        })
        self.assertEquals(4, self.config[self]['x'])
Пример #3
0
class test_Config(unittest.TestCase):
    def setUp(self):
        self.config = Config()
        self.files = Files()

    def tearDown(self):
        self.files.delete()

    def test_load_default(self):
        self.config.load_default()
        self.assertIsInstance(self.config['assembly'], list)

    def test_load(self):
        self.files.write('f1', (
            "x: 1\n"
            "y: 2"
        ))
        self.files.write('f2', (
            "x: 3\n"
            "z: 4"
        ))

        self.config.load([self.files.path('f1'), self.files.path('f2')])
        self.assertEquals({'x': 3, 'y': 2, 'z': 4}, self.config)

    def test_classes_config(self):
        self.config.load_dict({
            'classes': {
                self.__class__.__module__ + '.' + self.__class__.__name__: {
                    'x': 4}}})
        self.assertEquals(4, self.config[self]['x'])
Пример #4
0
 def setUp(self):
     self.config = Config()
     self.files = Files()
Пример #5
0
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from unittest import TestLoader
from unittest.runner import TextTestRunner
from os.path import dirname, abspath
import sys

from mousetrap.config import Config
CONFIG = Config().load_default()
print(CONFIG['camera'])

import logging
import logging.config
logging.config.dictConfig(CONFIG['logging-test'])
LOGGER = logging.getLogger('mousetrap.tests.run_python_tests')


def main():
    initialize_import_path()
    tests = load_tests()

    if not all_tests_pass(tests):
        sys.exit(1)


def initialize_import_path():
    paths = [get_source_directory()]
    print("appending " + str(paths))
    append_to_path(paths)
Пример #6
0
 def setUp(self):
     self.config = Config()
     self.files = Files()