使用 Python API 实现工作流自动化
R2026b完全通过 Python® 管理 Polyspace® Test™ 工作流 - 创建工程、添加源代码和测试、编译和运行:
import polyspace.project, polyspace.test
proj = polyspace.project.Project("myproject")
proj.Code.Files.add("src/utils.c")
proj.Tests.Files.add("tests/test.c")
res = polyspace.test.run(proj)在开始之前,请确保您的 Python 版本满足要求。有关详细信息,请参阅Set Up Python API for Polyspace。
polyspace 包
polyspace.__install_path__ | (Python) Get Polyspace installation folder |
polyspace.ErrorWithLog | (Python) Get error logs from actions on a Polyspace project |
polyspace.project 模块
polyspace.test 模块
主题
- Set Up Python API for Polyspace
Import
polyspacemodules in Python to create and manage Polyspace projects and results. - Python API for Polyspace 快速入门
创建和配置工程、编译和运行测试、生成报告。
- Calculate Code Coverage of C/C++ Code Using Python API for Polyspace
Run code profiling of C/C++ code using Python API for Polyspace.
- Generate Reports of C/C++ Test Results Using Python API for Polyspace
Save Polyspace Test results as XML or HTML reports.
- Create Project from Build System Using Python API for Polyspace
Dynamically generate source and build information for a project by tracing your build commands.
- Author Graphical Tests Using Python API for Polyspace
Create test suites and test cases, add assessments, build and run tests.
- Test Functions Containing Complex Data Types Using Python API for Polyspace
Create test suites, test cases, and test steps for functions with complex data types.
- Modularize Existing Project by Using Polyspace Python API
Use Python scripts to modularize existing projects by converting configurations and graphical tests to files referenced by the project.
- Create Project Dynamically by Using Polyspace Python API
Use Python scripts to dynamically generate projects from sources, configurations, and tests.
- Supported Operations on Sequences and Sets in Python API for Polyspace
Supported Python operations on sequence and set collection types in the Python API for Polyspace.