Example #1
0
import argparse
import sys

import colorama
import slash
import slash.site
from slash.utils.cli_utils import make_styler, Printer

_config_name_style = make_styler(colorama.Fore.WHITE + colorama.Style.BRIGHT)  # pylint: disable=no-member
_default_style = make_styler(colorama.Fore.GREEN + colorama.Style.BRIGHT)  # pylint: disable=no-member
_INDENT = ' ' * 4


def _parse_args(args):
    parser = argparse.ArgumentParser(prog='slash list-config')
    parser.add_argument('paths', nargs='*', default=[])
    parser.add_argument('--force-color',
                        dest='force_color',
                        action='store_true',
                        default=False)
    parser.add_argument('--no-color',
                        dest='enable_color',
                        action='store_false',
                        default=True)
    return parser.parse_args(args)


def list_config(args, report_stream=sys.stdout):

    args = _parse_args(args)
    _print = Printer(report_stream,
Example #2
0
def _colorized(string, style=None):
    if not style:
        return string
    return make_styler(style)(string)
Example #3
0
import argparse
import sys

import colorama
from slash.utils.cli_utils import make_styler, Printer

from slash import site
from slash.plugins import manager

_title_style = make_styler(colorama.Fore.WHITE + colorama.Style.BRIGHT)  # pylint: disable=no-member
_disabled_style = make_styler(colorama.Fore.BLACK + colorama.Style.BRIGHT)  # pylint: disable=no-member
_enabled_style = make_styler(colorama.Fore.GREEN)  # pylint: disable=no-member

_link_style = make_styler(colorama.Fore.CYAN)  # pylint: disable=no-member


def _get_parser():
    parser = argparse.ArgumentParser('slash list-plugins [options]')
    parser.add_argument('--force-color',
                        dest='force_color',
                        action='store_true',
                        default=False)
    parser.add_argument('--no-color',
                        dest='enable_color',
                        action='store_false',
                        default=True)
    return parser


def slash_list_plugins(args, report_stream=sys.stdout):
    parser = _get_parser()
Example #4
0
import itertools
import os
import sys
from functools import partial

import colorama
import slash
import slash.site
import slash.loader
from slash import config
from slash.exceptions import CannotLoadTests
from slash.utils.cli_utils import UNDERLINED, make_styler, Printer
from slash.utils.python import get_underlying_func
from slash.utils.suite_files import iter_suite_file_paths

_heading_style = make_styler(colorama.Fore.MAGENTA + colorama.Style.BRIGHT +
                             UNDERLINED)  # pylint: disable=no-member
_title_style = make_styler(colorama.Fore.WHITE + colorama.Style.BRIGHT)  # pylint: disable=no-member
_unused_style = make_styler(colorama.Fore.YELLOW)  # pylint: disable=no-member
_doc_style = make_styler(colorama.Fore.GREEN + colorama.Style.BRIGHT)  # pylint: disable=no-member
_override_style = make_styler(colorama.Fore.YELLOW + colorama.Style.BRIGHT)  # pylint: disable=no-member


def _get_parser():
    parser = argparse.ArgumentParser('slash list [options] PATH...')
    parser.add_argument('-f',
                        '--suite-file',
                        dest='suite_files',
                        action='append',
                        default=[])
    parser.add_argument('--only-fixtures',
                        dest='only',
Example #5
0
from __future__ import print_function

import argparse
import inspect
import itertools
import os
import sys
from functools import partial

import colorama
import slash
from slash.utils.cli_utils import UNDERLINED, make_styler
from slash.utils.python import get_underlying_func
from slash.utils.suite_files import iter_suite_file_paths

_heading_style = make_styler(colorama.Fore.MAGENTA + colorama.Style.BRIGHT + UNDERLINED)  # pylint: disable=no-member
_title_style = make_styler(colorama.Fore.WHITE + colorama.Style.BRIGHT)  # pylint: disable=no-member
_unused_style = make_styler(colorama.Fore.YELLOW)  # pylint: disable=no-member
_doc_style = make_styler(colorama.Fore.GREEN + colorama.Style.BRIGHT)  # pylint: disable=no-member


def _get_parser():
    parser = argparse.ArgumentParser('slash list [options] PATH...')
    parser.add_argument('-f', '--suite-file', dest='suite_files', action='append', default=[])
    parser.add_argument('--only-fixtures', dest='only', action='store_const', const='fixtures', default=None)
    parser.add_argument('--only-tests', dest='only', action='store_const', const='tests', default=None)
    parser.add_argument('--show-tags', dest='show_tags', action='store_true', default=False)
    parser.add_argument('paths', nargs='*', default=[], metavar='PATH')
    return parser

Example #6
0
from __future__ import print_function

import argparse
import sys
from functools import partial

import colorama
import slash
from slash.utils.cli_utils import make_styler

_config_name_style = make_styler(colorama.Fore.WHITE + colorama.Style.BRIGHT) # pylint: disable=no-member
_default_style = make_styler(colorama.Fore.GREEN + colorama.Style.BRIGHT) # pylint: disable=no-member
_INDENT = ' ' * 4

def _parse_args(args):
    parser = argparse.ArgumentParser('slash list-config [options] PATH...')
    return parser.parse_args(args)


def list_config(args, report_stream=sys.stdout):
    _print = partial(print, file=report_stream)

    args = _parse_args(args)

    with slash.Session():
        slash.site.load()

        for name, value in sorted(slash.config.traverse_leaves()):
            _print(_config_name_style(name), '--')
            _print(_INDENT, 'default:', _default_style(value.get_value()))
            if value.metadata and 'doc' in value.metadata: