Unit test helper
Project description
VTunit
This is a unit test/mock framework based on Unity and fff, aimed for embedded developers.
Installation
Install the package with pip
pip install -e git+https://github.com/vtunr/VTunit.git#egg=VTunitpip install -e .if you clone the repository (for development purpose)
Package to install (if you choose local build)
On ubuntu/WSL :
sudo apt-get install cmake ninja-build ruby- You'll also need
universal_ctag:
git clone https://github.com/universal-ctags/ctags.git
cd ctags
./autogen.sh
./configure
make
sudo make install
Setup unit test for a project
python -m vtunit {path_unit_test} init
Creating a new unit test
python -m vtunit {path_unit_test} new --file_name {my_file_name.c}
It will generate into the test folder:
test_{file_to_test}.ctest_{file_to_test}.cmake
You then need to add the c file you want to compile for your test in the test_{file_to_test}.cmake.
You can also add include in include.cmake
Automatic mocking
You can automatically mock header.
You just need to add mock_ prefix to the header you want to include :
#include "mock_my_header.h"
#include "mock_my_folder/my_header.h"
Prebuild / Postbuild
There is a way to run command before and after build (not after run)
You need to add :
list(APPEND PREBUILD_CMD && cmd_you_want)inprebuild.cmakelist(APPEND POSTBUILD_CMD && cmd_you_want)inpostbuild.cmake
Running test
Running in WSL or linux :
- If you want to force calling cmake (need to be done once before calling
run):python -m vtunit {path_unit_test} build --clean_all --cmake - Then to build and run :
python -m vtunit {path_unit_test} build --run - To clean :
python -m vtunit {path_unit_test} build --clean
You can also filter the test you want to run :
- To list :
python -m vtunit {path_unit_test} build --list --filter {my_regex}(optional--filter) - To filter :
python -m vtunit {path_unit_test} build --run --filter {my_regex}
You can also ignore prebuild/postbuild command by adding --ignore_prebuild and --ignore_postbuild
TODO :
- Improve argparse
- Add possibility to run it in a docker container
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file VTunit-0.0.1a0.tar.gz.
File metadata
- Download URL: VTunit-0.0.1a0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.1.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/2.7.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61544d8e56381be7c1163c7a35a9e691f8d037e622dbac79d1c5412a32b09379
|
|
| MD5 |
a8565a49bffa615a248d687af74c2603
|
|
| BLAKE2b-256 |
ead7295eb07ae8d375e85a6f6e0fd20b617047a17f262d3b9327bf3bc19a94ad
|
File details
Details for the file VTunit-0.0.1a0-py2-none-any.whl.
File metadata
- Download URL: VTunit-0.0.1a0-py2-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.1.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/2.7.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06aae6913495fb6a8e5b906a01c8c98dce8ed68b898defc9a6e1530c53aca8b5
|
|
| MD5 |
6fd56130ba8b828bd49799fd01be2075
|
|
| BLAKE2b-256 |
10c1d389e15e0575c24968e33d0d0cafb95c0a97d955e0fe7ad2f43cfbcb6b06
|