[docs] add guide on using python venv for cp-caps test (#11520)

Added comprehensive Python virtual environment setup guide to the
cp-caps README.md file.

This includes detailed sections for creation, activation, dependency
installation, and deactivation of virtual environments to help users
properly set up their testing environment and avoid package conflicts.
This commit is contained in:
Jason Zhang
2025-05-24 00:52:38 +08:00
committed by GitHub
parent 02390412cf
commit de8974aca4
+39 -8
View File
@@ -20,14 +20,6 @@ This test is used for testing RCP capabilities.
- DUT : The device under test.
- Reference Device : The device that supports all tested features.
### Python Dependences
Before running the test script on PC, testers should install dependences first.
```bash
$ pip3 install -r ./tools/cp-caps/requirements.txt ./tools/otci
```
### Reference Device
The [nRF52840DK][ot-nrf528xx-nrf52840] is set as the reference device by default. Testers can also select the other Thread device as the reference device.
@@ -47,6 +39,45 @@ $ nrfutil device program --firmware ot-cli-ftd.hex --options chip_erase_mode=ERA
$ nrfutil device reset --reset-kind=RESET_PIN
```
## Python Virtual Environment Setup
It is recommended to use a Python virtual environment to manage project dependencies and avoid conflicts with system-wide packages.
### Creation
Create a virtual environment named `.venv` in the project directory:
```bash
$ cd openthread
$ python3 -m venv .venv
```
### Activation
Activate the virtual environment using the following command:
```bash
$ source .venv/bin/activate
```
After activation, your shell prompt should indicate that you are working within the virtual environment.
### Dependency Installation
Once the virtual environment is activated, install the required dependencies using `pip`:
```bash
$ pip3 install -r ./tools/cp-caps/requirements.txt ./tools/otci
```
### Deactivation
When you are finished working in the virtual environment, you can deactivate it by running the following command. This will return you to your system's global Python environment.
```bash
$ deactivate
```
## Test Commands
### Help Info