No project description provided
Project description
cocotb-test
cocotb-test
provides standard python unit testing capabilities for cocotb
- allow the look and feel of Python unit testing
- remove the need for Makefiles (includes Makefile compatibility mode)
- allow easy customization of simulation flow
- allow to use pytest-xdist or pytest-parallel for parallel runs
Usage:
-
Install cocotb.
-
Install simulator (for Icarus Verilog with conda):
conda install -c conda-forge iverilog
- Install the package via pip:
pip install cocotb-test
or development version
pip install -v https://github.com/themperek/cocotb-test/archive/master.zip
or
git clone https://github.com/themperek/cocotb-test.git
pip install -v -e cocotb-test
- Create a
test_dff.py
file (check test folder for more examples):
from cocotb_test.simulator import run
def test_dff():
run(
verilog_sources=["dff.v"], # sources
toplevel="dff", # top level HDL
module="dff_cocotb" # name of cocotb test module
)
- Run pytest:
pytest -o log_cli=True
Running (some) tests and examples from cocotb
For cocotb tests/examples install cocotb in editable mode
git clone https://github.com/potentialventures/cocotb.git
pip install -e cocotb
SIM=icarus pytest -o log_cli=True --junitxml=test-results.xml --cocotbxml=test-cocotb.xml tests
Related resources
- pytest logging - pytest logging documentation
- pytest-xdist - test run parallelization (see test_parallel)
- pytest-parallel - parallel and concurrent testing (see test_parallel)
- pytest-html - generates a HTML report for the test results
- pytest-sugar - sugar
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
cocotb-test-0.1.1.tar.gz
(11.5 kB
view hashes)