Skip to content

Latest commit

 

History

History
46 lines (38 loc) · 1.91 KB

developing.md

File metadata and controls

46 lines (38 loc) · 1.91 KB

Developing VUnit

Code contributions are expected to pass all tests and style checks.

Running the tests

The test suite is divided into three parts:

  1. vunit/test/unit/
    • Short and concise unit tests for internal modules and classes.
  2. vunit/test/acceptance/
    • End to end tests of public functionality. Depends on external tools such as simulators.
  3. vunit/test/lint/
    • Style checks such as PEP8 and license header verification.
# Run all tests
vunit/ > python -m unittest discover vunit/test

# Run just the unit tests
vunit/ > python -m unittest discover vunit/test/unit

The test suites must work using both Python 2.7 and Python 3.x.

Running with different simulator back-ends

VUnit supports both ModelSim and GHDL and the acceptance tests must work for both simulators. The acceptance tests can be run for a specific simulator by setting the VUNIT_SIMULATOR environment variable:

vunit/ > VUNIT_SIMULATOR=ghdl python -m unittest discover vunit/test/acceptance/

Dependencies

Other that the dependencies required to use VUnit as a user the following are also required for developers to run the test suite:

Code coverage

Code coverage can be measured using the coverage tool. The following commands measure the code coverage while running the entire test suite:

vunit/ > coverage run --branch --source vunit/ -m unittest discover vunit/test/
vunit/ > coverage html --directory=htmlcov
vunit/ > open htmlcov/index.html

Developers should ensure that new code is well covered. As of writing this paragraph the total coverage was 92%. Missing coverage can be analyzed by opening the generated htmlcov/index.html produced by the above commands.