Пример #1
0
 def test_option_only_long_name_SHOULD_produce_long_name(self):
     # ARRANGE #
     renderer = sut.ArgumentOnCommandLineRenderer()
     argument_usage = arg.short_long_option(long_name='long')
     # ACT #
     actual = renderer.visit(argument_usage)
     # ASSERT #
     self.assertEqual('--long', actual)
Пример #2
0
    return cli_syntax.Synopsis(command_line, _TP.text(_DESCRIPTION_PARAGRAPH))


_SINGLE_LINE_DESCRIPTION = 'Runs a test case'

_DESCRIPTION_PARAGRAPH = """\
Runs the test case in file {TEST_CASE_FILE}.
"""

_OUTCOME_INITIAL_PARAGRAPHS_EXTRA = """\
See test case specification for details.
"""

_OPTION_PLACEHOLDER_ARGUMENT = arg.Named('OPTION')

_ACTOR_OPTION = arg.short_long_option(
    long_name=common_cli_options.OPTION_FOR_ACTOR__LONG,
    argument=common_cli_options.ACTOR_OPTION_ARGUMENT)

_KEEP_SANDBOX_OPTION = arg.short_long_option(
    long_name=opt.OPTION_FOR_KEEPING_SANDBOX_DIRECTORY__LONG,
    short_name=opt.OPTION_FOR_KEEPING_SANDBOX_DIRECTORY__SHORT)

_EXECUTING_ACT_PHASE_OPTION = arg.short_long_option(
    long_name=opt.OPTION_FOR_EXECUTING_ACT_PHASE__LONG)

_TP = TextParser({
    'TEST_CASE_FILE': TEST_CASE_FILE_ARGUMENT.name,
    'default_suite_file': file_names.DEFAULT_SUITE_FILE,
})
Пример #3
0
from exactly_lib.definitions.test_suite import file_names
from exactly_lib.help.contents_structure.cli_program import CliProgramSyntaxDocumentation
from exactly_lib.help.program_modes.common.cli_syntax import FILES_DESCRIPTION_WITH_DEFAULT_SUITE
from exactly_lib.help.program_modes.test_suite.contents.cli_syntax import DEFAULT_SUITE_FILES_DESCRIPTION
from exactly_lib.help.render.cli_program import \
    ProgramDocumentationSectionContentsConstructor
from exactly_lib.util.cli_syntax.elements import argument as arg
from exactly_lib.util.cli_syntax.elements import cli_program_syntax as cli_syntax
from exactly_lib.util.description import DescriptionWithSubSections
from exactly_lib.util.textformat.constructor.environment import ConstructionEnvironment
from exactly_lib.util.textformat.section_target_hierarchy import hierarchies as h
from exactly_lib.util.textformat.section_target_hierarchy.generator import SectionHierarchyGenerator
from exactly_lib.util.textformat.structure import structures as docs
from exactly_lib.util.textformat.textformat_parser import TextParser

_INDIVIDUAL_REFERENCES_OPTION = arg.short_long_option(
    long_name=command_line_options.OPTION_FOR_SYMBOL_REFERENCES__LONG)


def root(header: str) -> SectionHierarchyGenerator:
    return h.with_fixed_root_target(
        PredefinedHelpContentsPartReference(
            HelpPredefinedContentsPart.SYMBOL_CLI),
        h.leaf(
            header,
            ProgramDocumentationSectionContentsConstructor(
                SymbolCliSyntaxDocumentation())))


class SymbolCliSyntaxDocumentation(CliProgramSyntaxDocumentation):
    def __init__(self):
        super().__init__(program_info.PROGRAM_NAME)
Пример #4
0
from exactly_lib.cli.definitions.program_modes.test_case import command_line_options as opt
from exactly_lib.util.cli_syntax.elements import argument as arg

TEST_CASE_FILE_ARGUMENT = arg.Named(opt.TEST_CASE_FILE_ARGUMENT)

PREPROCESSOR_OPTION = arg.short_long_option(long_name=opt.OPTION_FOR_PREPROCESSOR__LONG,
                                            argument=opt.PREPROCESSOR_OPTION_ARGUMENT)

SUITE_OPTION = arg.short_long_option(long_name=opt.OPTION_FOR_SUITE__LONG,
                                     argument=opt.SUITE_OPTION_METAVAR)

FILES_DESCRIPTION_WITH_DEFAULT_SUITE = """\
If there exists a file "{default_suite_file}" in the same directory as {TEST_CASE_FILE},
then this file must be a test suite, and the test case is run as part of this suite. 
"""
Пример #5
0
_DESCRIPTION_PARAGRAPH = """\
Runs the test suite in file {TEST_SUITE_FILE}.
"""

_ACTOR_OPTION_DESCRIPTION = """\
Specifies a default {interpreter_actor} {actor} to use for every test case in the suite.


{interpreter_program} {is_a_shell_cmd}


Note: An {actor} specified in the test suite or individual test cases
will have precedence over the {actor} specified by this option.
"""

_ACTOR_OPTION = arg.short_long_option(long_name=common_cli_options.OPTION_FOR_ACTOR__LONG,
                                      argument=common_cli_options.ACTOR_OPTION_ARGUMENT)

_REPORTER_OPTION = arg.short_long_option(long_name=opts.OPTION_FOR_REPORTER__LONG,
                                         argument=opts.REPORTER_OPTION_ARGUMENT)

_REPORTER_OPTION_DESCRIPTION = """\
Specifies in which format to report the execution of the test suite
(stdout, stderr, exit code).


Options: {reporter_name_list} (default {default_reporter_name}).
"""

_FILE_ARGUMENT = arg.Named(opts.TEST_SUITE_FILE_ARGUMENT)

_FILES_DESCRIPTION = """\
Пример #6
0
from exactly_lib.definitions.test_suite import file_names
from exactly_lib.help.contents_structure.cli_program import CliProgramSyntaxDocumentation
from exactly_lib.help.program_modes.common.cli_syntax import FILES_DESCRIPTION_WITH_DEFAULT_SUITE, \
    TEST_CASE_FILE_ARGUMENT
from exactly_lib.help.render.cli_program import \
    ProgramDocumentationSectionContentsConstructor
from exactly_lib.util.cli_syntax.elements import argument as arg
from exactly_lib.util.cli_syntax.elements import cli_program_syntax as cli_syntax
from exactly_lib.util.description import DescriptionWithSubSections
from exactly_lib.util.textformat.constructor.environment import ConstructionEnvironment
from exactly_lib.util.textformat.section_target_hierarchy import hierarchies as h
from exactly_lib.util.textformat.section_target_hierarchy.generator import SectionHierarchyGenerator
from exactly_lib.util.textformat.structure import structures as docs
from exactly_lib.util.textformat.textformat_parser import TextParser

_INDIVIDUAL_REFERENCES_OPTION = arg.short_long_option(long_name=OPTION_FOR_SYMBOL_REFERENCES__LONG)


def root(header: str) -> SectionHierarchyGenerator:
    return h.with_fixed_root_target(
        PredefinedHelpContentsPartReference(HelpPredefinedContentsPart.SYMBOL_CLI),
        h.leaf(
            header,
            ProgramDocumentationSectionContentsConstructor(SymbolCliSyntaxDocumentation()))
    )


class SymbolCliSyntaxDocumentation(CliProgramSyntaxDocumentation):
    def __init__(self):
        super().__init__(program_info.PROGRAM_NAME)
Пример #7
0
Runs the test suite in file {TEST_SUITE_FILE}.
"""

_ACTOR_OPTION_DESCRIPTION = """\
Specifies a default {interpreter_actor} {actor} to use for every test case in the suite.


{interpreter_program} {is_a_system_cmd}


{NOTE} An {actor} specified in the test suite or individual test cases
will have precedence over the {actor} specified by this option.
"""

_ACTOR_OPTION = arg.short_long_option(
    long_name=common_cli_options.OPTION_FOR_ACTOR__LONG,
    argument=common_cli_options.ACTOR_OPTION_ARGUMENT)

_REPORTER_OPTION = arg.short_long_option(
    long_name=opts.OPTION_FOR_REPORTER__LONG,
    argument=opts.REPORTER_OPTION_ARGUMENT)

_REPORTER_OPTION_DESCRIPTION = """\
Specifies in which format to report the execution of the test suite
(stdout, stderr, exit code).


Options: {reporter_name_list} (default {default_reporter_name}).
"""

_FILE_ARGUMENT = arg.Named(opts.TEST_SUITE_FILE_ARGUMENT)
Пример #8
0
                   TEST_CASE_FILE_ARGUMENT)],
        prefix=program_info.PROGRAM_NAME)
    return cli_syntax.Synopsis(command_line,
                               _TP.text(_DESCRIPTION_PARAGRAPH))


_SINGLE_LINE_DESCRIPTION = 'Runs a test case'

_DESCRIPTION_PARAGRAPH = """\
Runs the test case in file {TEST_CASE_FILE}.
"""

_OUTCOME_INITIAL_PARAGRAPHS_EXTRA = """\
See test case specification for details.
"""

_OPTION_PLACEHOLDER_ARGUMENT = arg.Named('OPTION')

_ACTOR_OPTION = arg.short_long_option(long_name=common_cli_options.OPTION_FOR_ACTOR__LONG,
                                      argument=common_cli_options.ACTOR_OPTION_ARGUMENT)

_KEEP_SANDBOX_OPTION = arg.short_long_option(long_name=opt.OPTION_FOR_KEEPING_SANDBOX_DIRECTORY__LONG,
                                             short_name=opt.OPTION_FOR_KEEPING_SANDBOX_DIRECTORY__SHORT)

_EXECUTING_ACT_PHASE_OPTION = arg.short_long_option(long_name=opt.OPTION_FOR_EXECUTING_ACT_PHASE__LONG)

_TP = TextParser({
    'TEST_CASE_FILE': TEST_CASE_FILE_ARGUMENT.name,
    'default_suite_file': file_names.DEFAULT_SUITE_FILE,
})