[Docs][PyOV] Add information about testing pyapi (#14645)
* [Docs][PyOV] Add information about testing pyapi * apply comments and add links * apply comments * empty * apply changes * apply comments * comments
This commit is contained in:
parent
fda677f153
commit
ceab44eee6
@ -84,7 +84,7 @@ from openvino.helpers.custom_module import top1_index
|
|||||||
```
|
```
|
||||||
**Do not forget to include a license on the top of each file!** For demonstration purposes, it has been skipped in the snippets above.
|
**Do not forget to include a license on the top of each file!** For demonstration purposes, it has been skipped in the snippets above.
|
||||||
|
|
||||||
To see changes taking effect, rebuild the project (CMake's install step should be good enough <!-- TODO: Add link to BUILDING.md section -->) and run your solution:
|
To see the changes take effect, [rebuild the project](../../../../docs/dev/build.md) and run your solution:
|
||||||
```python
|
```python
|
||||||
import openvino.helpers as ov_helpers
|
import openvino.helpers as ov_helpers
|
||||||
|
|
||||||
@ -402,9 +402,8 @@ Great! Now the class has reached its destination, from C++, to Python, to Python
|
|||||||
|
|
||||||
This concludes developer work on OpenVINO™ Python API. Don't forget to recompile your builds and have a good time while writing your code!:)
|
This concludes developer work on OpenVINO™ Python API. Don't forget to recompile your builds and have a good time while writing your code!:)
|
||||||
|
|
||||||
#### Testing out new code
|
### Testing the new code
|
||||||
All of the code is now written. Let's move on to testing.
|
|
||||||
|
|
||||||
Please refer to the Test Guide available here:
|
Coding is now finished. Let's move on to testing.
|
||||||
|
|
||||||
openvino/src/bindings/python/docs/test_examples.md
|
To learn how to test your code, refer to the guide on [how to test OpenVINO™ Python API?](./test_examples.md#Running_OpenVINO™_Python_API_tests)
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
# Contributing to OpenVINO™ Python API
|
# Contributing to OpenVINO™ Python API
|
||||||
|
|
||||||
#### Prerequisites
|
#### Prerequisites
|
||||||
*To be added...*
|
|
||||||
|
|
||||||
##### Enviroment
|
##### Enviroment
|
||||||
In case the Python version you have is not supported by OpenVINO, you can refer to [openvino/src/bindings/python/docs/python_version_upgrade.md](https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/python/docs/python_version_upgrade.md) for instructions on how to download and build a newer, supported Python version.
|
In case the Python version you have is not supported by OpenVINO, you can refer to [openvino/src/bindings/python/docs/python_version_upgrade.md](https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/python/docs/python_version_upgrade.md) for instructions on how to download and build a newer, supported Python version.
|
||||||
<!-- TODO: Link to enviroment setup -->
|
|
||||||
*To be added...*
|
The environment setup is described as part of the pyenv example in [the build.md page](./build.md#Example:_using_pyenv_with_OpenVINO™_on_Linux_based_system).
|
||||||
|
|
||||||
##### Building
|
##### Building
|
||||||
Building instructions can be found in [BUILDING.md](../BUILDING.md)
|
Building instructions can be found in [build.md](./build.md#_Building_the_OpenVINO™_Python_API).
|
||||||
|
|
||||||
## Contribution guidelines and best practices
|
## Contribution guidelines and best practices
|
||||||
|
|
||||||
@ -17,14 +16,12 @@ Building instructions can be found in [BUILDING.md](../BUILDING.md)
|
|||||||
It is nothing special... :) First, make sure that all prerequisites are met and focus on writing the code itself. A good starting point is to have some knowledge of the Python language. C++ is also a vital language for OpenVINO™, so it is not a surprise that it is used in this part of the project as well.
|
It is nothing special... :) First, make sure that all prerequisites are met and focus on writing the code itself. A good starting point is to have some knowledge of the Python language. C++ is also a vital language for OpenVINO™, so it is not a surprise that it is used in this part of the project as well.
|
||||||
|
|
||||||
Code snippets and detailed explanations can be found here:
|
Code snippets and detailed explanations can be found here:
|
||||||
<!-- Link to EXAMPLES -->
|
|
||||||
openvino/src/bindings/python/docs/code_example.md
|
[Examples of OpenVINO™ Python API code](./code_example.md)
|
||||||
|
|
||||||
##### Always test out our code! Don't forget about it before pushing and triggering CIs.
|
##### Always test out our code! Don't forget about it before pushing and triggering CIs.
|
||||||
|
|
||||||
Please refer to Test Guide available here:
|
To learn how to test your code, refer to the guide on [how to test OpenVINO™ Python API?](./test_examples.md#Running_OpenVINO™_Python_API_tests)
|
||||||
|
|
||||||
openvino/src/bindings/python/docs/test_examples.md
|
|
||||||
|
|
||||||
Moreover, the project utilizes *flake8* and *mypy* packages to run codestyle checks. Additionally OpenVINO™ uses the custom configuration file to exclude some strict rules. To run codestyle checks, navigate to the main Python API folder first and use following commands:
|
Moreover, the project utilizes *flake8* and *mypy* packages to run codestyle checks. Additionally OpenVINO™ uses the custom configuration file to exclude some strict rules. To run codestyle checks, navigate to the main Python API folder first and use following commands:
|
||||||
```shell
|
```shell
|
||||||
|
@ -3,18 +3,38 @@
|
|||||||
#### Building and environment
|
#### Building and environment
|
||||||
Instructions can be found in ["Building the OpenVINO™ Python API"](./build.md).
|
Instructions can be found in ["Building the OpenVINO™ Python API"](./build.md).
|
||||||
|
|
||||||
### Running OpenVINO™ Python API tests
|
Install the specific requirements file for testing:
|
||||||
|
```
|
||||||
|
python -m pip install -r openvino/src/bindings/python/requirements_test.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
Make sure that Python libraries are added to the user environment variables:
|
||||||
|
```
|
||||||
|
export PYTHONPATH=PYTHONPATH:<openvino_repo>/bin/intel64/Release/python_api/python3.7
|
||||||
|
```
|
||||||
|
### Run OpenVINO™ Python API tests
|
||||||
*For simplicity, all of these commands require to navigate to the main Python API folder first:*
|
*For simplicity, all of these commands require to navigate to the main Python API folder first:*
|
||||||
```shell
|
```shell
|
||||||
cd .../openvino/src/bindings/python/
|
cd .../openvino/src/bindings/python/
|
||||||
```
|
```
|
||||||
|
|
||||||
To run **all tests**:
|
To run OpenVINO Python API 2.0 tests:
|
||||||
```shell
|
```shell
|
||||||
pytest tests/
|
pytest tests/
|
||||||
```
|
```
|
||||||
|
|
||||||
Test framework *pytest* allows to filter tests with `-k` flag.
|
To run OpenVINO Python API 1.0 tests, use this command:
|
||||||
|
```
|
||||||
|
pytest tests_compatibility/
|
||||||
|
```
|
||||||
|
|
||||||
|
By default, tests are run on the CPU plugin. If you want to run them on a different plugin,
|
||||||
|
you need to specify this environment variable:
|
||||||
|
```
|
||||||
|
export TEST_DEVICE=GPU
|
||||||
|
```
|
||||||
|
|
||||||
|
The *pytest* test framework enables you to filter tests with the `-k` flag.
|
||||||
```shell
|
```shell
|
||||||
pytest tests/test_runtime/test_core.py -k "test_available_devices"
|
pytest tests/test_runtime/test_core.py -k "test_available_devices"
|
||||||
```
|
```
|
||||||
@ -35,6 +55,31 @@ To run full test suite one can utilize `tox` command:
|
|||||||
tox
|
tox
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Check the codestyle of Python API
|
||||||
|
There are two packages used in the project to check the codestyle of python code: *mypy* and *flake8*.
|
||||||
|
Besides, OpenVINO™ uses a custom configuration file to exclude some strict rules.
|
||||||
|
|
||||||
|
To check the codestyle of the Python API 2.0, run the following commands:
|
||||||
|
```
|
||||||
|
python -m flake8 ./src/openvino/ --config=setup.cfg
|
||||||
|
python -m mypy ./src/openvino --config-file ./setup.cfg
|
||||||
|
```
|
||||||
|
To check the codestyle of the nGraph Python API, run the following commands:
|
||||||
|
```
|
||||||
|
python -m flake8 ./src/compatibility/ngraph/ --config=setup.cfg
|
||||||
|
python -m mypy ./src/compatibility/ngraph --config-file ./setup.cfg
|
||||||
|
```
|
||||||
|
To check the codestyle of the InferenceEngine Python API, run the following commands:
|
||||||
|
```
|
||||||
|
cd src/compatibility/openvino
|
||||||
|
python -m flake8 ./ --config=setup.cfg
|
||||||
|
python -m mypy ./ --config-file ./setup.cfg
|
||||||
|
```
|
||||||
|
It's recommended to run the mentioned codestyle check whenever new tests are added.
|
||||||
|
This check should be executed from the main Python API folder:
|
||||||
|
```
|
||||||
|
python -m flake8 ./tests/ --config=setup.cfg
|
||||||
|
```
|
||||||
### Writing OpenVINO™ Python API tests
|
### Writing OpenVINO™ Python API tests
|
||||||
###### Before start
|
###### Before start
|
||||||
Follow and complete `openvino/src/bindings/python/docs/code_examples.md`.
|
Follow and complete `openvino/src/bindings/python/docs/code_examples.md`.
|
||||||
|
Loading…
Reference in New Issue
Block a user