From de8974aca4668e633c899297838162c0ea5def76 Mon Sep 17 00:00:00 2001 From: Jason Zhang Date: Sat, 24 May 2025 00:52:38 +0800 Subject: [PATCH] [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. --- tools/cp-caps/README.md | 47 ++++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/tools/cp-caps/README.md b/tools/cp-caps/README.md index f1977434e..b98d7344b 100644 --- a/tools/cp-caps/README.md +++ b/tools/cp-caps/README.md @@ -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