Skip to content

here I show how can you run the test c code with pytest and get coverage.

Notifications You must be signed in to change notification settings

dsouzajaison/pytest-c-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pytest-c-code

Here I would like show how can you test c code with pytest and get coverage. I am using a simple calculator.c to get the check the tests coverage of the binaries

Create a virtual environment

python3 -m venv toolchain

The above command creates a virtual environment named toolchain. Activate the toolchain in order to install our dependencies

 source toolchain/bin/activate

Now install dependencies from the requirements.txt file

pip install -r requirement.txt

We use gcovr package to get the coverage for the test run

pytest tests.py::test_function_name

This will output an txt file which shows us the code coverage by that function.

About

here I show how can you run the test c code with pytest and get coverage.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published