当前位置: 首页>>代码示例>>Python>>正文


Python Project.run_tests方法代码示例

本文整理汇总了Python中chiptools.core.project.Project.run_tests方法的典型用法代码示例。如果您正苦于以下问题:Python Project.run_tests方法的具体用法?Python Project.run_tests怎么用?Python Project.run_tests使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在chiptools.core.project.Project的用法示例。


在下文中一共展示了Project.run_tests方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: cmdloop

# 需要导入模块: from chiptools.core.project import Project [as 别名]
# 或者: from chiptools.core.project.Project import run_tests [as 别名]
# to 'False', this tells the synthesis tool not to try to synthesise this file.
# If not specified, 'synthesise' will default to 'True'
project.add_file(
    'tb_axi_lite_slave_example.v',
    library='lib_tb_example',
    synthesise=False
)

if __name__ == '__main__':

    interactive = True  # Set True to load the ChipTools CLI

    if interactive:
        # ChipTools provides a command line interface to allow you to perform
        # actions on the project such as synthesis and simulation interactively.
        # It can be launched by importing the CommandLine from chiptools.core.cli
        # and executing the cmdloop() method - the project is passed to the
        # CommandLine constructor. Launch the ChipTools command line with the
        # project we just configured:
        from chiptools.core.cli import CommandLine
        CommandLine(project).cmdloop()
    else:
        # Run the automated unit tests on the project:
        project.run_tests(tool_name='vivado')
        # Synthesise the project:
        project.synthesise(
            library='lib_example',
            entity='axi_lite_slave_example',
            tool_name='vivado'
        )
开发者ID:kayws426,项目名称:axi-lite-gen,代码行数:32,代码来源:axi_lite_slave_example_project.py

示例2: CommandLine

# 需要导入模块: from chiptools.core.project import Project [as 别名]
# 或者: from chiptools.core.project.Project import run_tests [as 别名]

#.........这里部分代码省略.........
                        )
                    print(msg)
                    print(term.darkgray(textwrap.fill(
                        doc,
                        width=80,
                        initial_indent=SEP * 2,
                        subsequent_indent=SEP * 2,
                    )))
                    testUniqueId += 1

    def show_test_selection(self):
        """
        Show the currently selected tests in the current project.
        Add or remove tests using the
        add_tests and remove_tests commands respectively.
        """
        ids_list = list(self.test_set)
        tests = []
        for file_object in self.project.get_tests():
            file_name = os.path.basename(file_object.path)
            print(term.yellow(file_name))
            for test_group in file_object.testsuite:
                for testId, test in enumerate(test_group):
                    if testId == 0:
                        groupName = str(test.__class__.__name__)
                    testName = test.id().split('.')[-1]
                    tests.append((file_name, groupName, testName, test))

        # Filter out any invalid indices
        ids_list = list(filter(lambda x: x < len(tests), ids_list))
        for idx, (fileName, groupName, testName, test) in enumerate(
            [tests[idx] for idx in ids_list]
        ):
            print(
                '{:<5}'.format(str(ids_list[idx]) + ':') +
                '[' + term.yellow(fileName) + ']' +
                '[' + term.green(groupName) + ']' +
                '[' + term.blue(testName) + ']'
            )

    @wraps_do_commands
    def do_add_tests(self, command):
        """
        Add the given tests to the test suite. Tests should be supplied as
        comma separated numbers or numeric ranges, for example:

        add_tests 1-3, 5, 6, 7

        Would add tests 1, 2, 3, 5, 6, 7 to the test suite.

        You can check which tests are available by issuing the show_tests
        command or remove tests that have been added to the suite by issuing
        the remove_tests command.
        """
        try:
            ids = utils.parseRange(command)
        except ValueError:
            log.error('Invalid test range specified: ' + command)
            return
        for testId in ids:
            self.test_set.add(testId)
        self.show_test_selection()

    @wraps_do_commands
    def do_remove_tests(self, command):
        """
        Remove the given tests from the test suite. Tests should be supplied
        as comma separated numbers or numeric ranges, for example:

        remove_tests 1-3, 5, 6, 7

        Would remove tests 1, 2, 3, 5, 6, 7 from the test suite.

        You can check which tests are available by issuing the show_tests
        command or add tests by issuing the add_tests command.
        """
        try:
            ids = utils.parseRange(command)
        except ValueError:
            log.error('Invalid test range specified: ' + command)
            return
        for testId in ids:
            try:
                self.test_set.remove(testId)
            except KeyError:
                pass
        self.show_test_selection()

    @wraps_do_commands
    def do_run_tests(self, command):
        """
        Run the tests that were selected via the add_tests command and report
        the results.
        """
        if len(command) > 0:
            tool_name = command
        else:
            tool_name = None
        self.show_test_selection()
        self.project.run_tests(self.test_set, tool_name=tool_name)
开发者ID:hoangt,项目名称:chiptools,代码行数:104,代码来源:cli.py

示例3: cmdloop

# 需要导入模块: from chiptools.core.project import Project [as 别名]
# 或者: from chiptools.core.project.Project import run_tests [as 别名]
# to 'False', this tells the synthesis tool not to try to synthesise this file.
# If not specified, 'synthesise' will default to 'True'
project.add_file(
    'tb_max_hold.vhd',
    library='lib_tb_max_hold',
    synthesise=False
)

if __name__ == '__main__':

    interactive = False  # Set True to load the ChipTools CLI

    if interactive:
        # ChipTools provides a command line interface to allow you to perform
        # actions on the project such as synthesis and simulation interactively.
        # It can be launched by importing the CommandLine from chiptools.core.cli
        # and executing the cmdloop() method - the project is passed to the
        # CommandLine constructor. Launch the ChipTools command line with the
        # project we just configured:
        from chiptools.core.cli import CommandLine
        CommandLine(project).cmdloop()
    else:
        # Run the automated unit tests on the project:
        project.run_tests(tool_name='ghdl')
        # Synthesise the project:
        project.synthesise(
            library='lib_max_hold',
            entity='max_hold',
            tool_name='vivado'
        )
开发者ID:pabennett,项目名称:chiptools,代码行数:32,代码来源:max_hold_project.py


注:本文中的chiptools.core.project.Project.run_tests方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。