def test_normalize_path(value):
    expected = os.path.abspath(os.path.expanduser(value))

    assert normalize_path(value) == expected
def test_normalize_path_option(value):
    expected = [normalize_path(path) for paths in value for path in paths.split(',')]

    assert normalize_path_option(value) == expected
Exemple #3
0
from gluetool import GlueError, GlueRetryError, Failure
from gluetool.help import extract_eval_context_info, docstring_to_help
from gluetool.glue import PipelineStep
from gluetool.log import log_dict
from gluetool.utils import format_command_line, cached_property, normalize_path, render_template, \
    normalize_multistring_option

# Type annotations
# pylint: disable=unused-import,wrong-import-order
from typing import cast, Any, Callable, List, Optional, NoReturn, Union  # noqa
from types import FrameType  # noqa

# Order is important, the later one overrides values from the former
DEFAULT_GLUETOOL_CONFIG_PATHS = [
    '/etc/gluetool.d/gluetool',
    normalize_path('~/.gluetool.d/gluetool'),
    normalize_path('./.gluetool.d/gluetool')
]

DEFAULT_HANDLED_SIGNALS = (signal.SIGUSR2, )


def handle_exc(func):
    # type: (Callable[..., Any]) -> Callable[..., Any]

    @functools.wraps(func)
    def wrapped(self, *args, **kwargs):
        # type: (Gluetool, *Any, **Any) -> Any

        # pylint: disable=broad-except, protected-access