예제 #1
0
   hspylib.main.hspylib.addons.appman.templates
      @file: tpl-main.py
   @created: Tue, 1 Jun 2021
    @author: <B>H</B>ugo <B>S</B>aporetti <B>J</B>unior"
      @site: https://github.com/yorevs/hspylib
   @license: MIT - Please refer to <https://opensource.org/licenses/MIT>

   Copyright 2021, HSPyLib team
"""

import sys

from hspylib.core.tools.commons import dirname, get_path, read_version, sysout
from hspylib.modules.cli.application.application import Application

HERE = get_path(__file__)


class Main(Application):
    """TODO"""

    # The application version
    VERSION = read_version(f"{HERE}/.version")

    # Usage message
    USAGE = (HERE / "usage.txt").read_text().format('.'.join(map(str,
                                                                 VERSION)))

    def __init__(self, app_name: str):
        # Invoke the super constructor without source_dir parameter to skip creation of log and properties
        super().__init__(app_name,
예제 #2
0
   @created: Tue, 4 May 2021
    @author: <B>H</B>ugo <B>S</B>aporetti <B>J</B>unior"
      @site: https://github.com/yorevs/hspylib
   @license: MIT - Please refer to <https://opensource.org/licenses/MIT>

   Copyright 2021, HSPyLib team
"""

import logging as log
import sys
import unittest

from hspylib.core.config.properties import Properties
from hspylib.core.tools.commons import get_path

TEST_DIR = get_path(__file__)


class TestProperties(unittest.TestCase):

    # TEST CASES ----------
    def test_should_load_properties_using_defaults(self):
        expected_size = 6
        properties = Properties()
        self.assertIsNotNone(properties)
        self.assertEqual(expected_size, len(properties))
        log.info(properties)

    def test_should_load_properties_using_custom_attributes(self):
        expected_size = 6
        load_dir = f'{TEST_DIR}/resources'