Skip to main content

pytest plugin for toffee testing

Project description

toffee-test

PyPI version

English Version | 中文版本

toffee-test is a pytest plugin that provides testing support for the toffee framework. It includes several features to assist users in writing test cases for toffee:

  • Identifies test functions as toffee test case objects, making them recognizable and executable by the toffee framework
  • Offers resource management for test cases, such as DUT creation and destruction
  • Provides test report generation

Installation

  • Properly install toffee and its dependencies.

  • Install toffee-test

To install toffee-test via pip:

pip install toffee-test

Or install the development version:

pip install toffee-test@git+https://github.com/XS-MLVP/toffee-test@master

Or install from source:

git clone https://github.com/XS-MLVP/toffee-test.git
cd toffee-test
pip install .

Usage

Managing Test Case Resources

toffee-test provides the toffee_request fixture for managing test case resources. Use toffee_request to create your own fixture, which can then be used within test cases.

For example, the following code creates a fixture to manage DUT creation and destruction.

import toffee_test


@toffee_test.fixture
def my_fixture(toffee_request: toffee_test.ToffeeRequest):
    return toffee_request.create_dut(MyDUT, "clock_pin_name")

Interfaces provided in toffee_request include:

  • create_dut: Creates a DUT
    • dut_cls: DUT class
    • clock_name: Clock name
    • waveform_filename: Waveform file name
    • coverage_filename: Coverage file name
  • add_cov_groups: Adds coverage groups
    • cov_groups: Coverage groups
    • periodic_sample: Periodic sampling option

Marking Test Cases

Use the @toffee_test.testcase decorator to mark test functions, making them recognizable and executable by the toffee framework.

Generating Test Reports

By adding the --toffee-report parameter to the pytest command line, you can generate a toffee test report.

Additionally, the --report-name parameter can specify the report name, and --report-dir can specify the report directory.

Additional Resources

More resources are available at toffee and UnityChip Website.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

toffee_test-0.3.0.tar.gz (27.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

toffee_test-0.3.0-py3-none-any.whl (34.4 kB view details)

Uploaded Python 3

File details

Details for the file toffee_test-0.3.0.tar.gz.

File metadata

  • Download URL: toffee_test-0.3.0.tar.gz
  • Upload date:
  • Size: 27.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for toffee_test-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4c4433b869e310507ea2a23ebb57ae999a09743fb5d0ac9d26d1672b8b96067c
MD5 73dc2f7ffb603a59d434f5336c49aa6c
BLAKE2b-256 28c09ce36fa9691ba8e85ddf13cc915d8ccf70e1828b6f885961ed3714d92525

See more details on using hashes here.

File details

Details for the file toffee_test-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: toffee_test-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 34.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for toffee_test-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8e99d3230d1ae8a31c9de00621986429c54dd6cbefccf21e0af39bfe575f706a
MD5 9c17b6afbcba766b623ca485aa7e60dc
BLAKE2b-256 490769e283f85885ed2a2d075a3e087cf2b73bf4a3e2cef599e11e5192cf1e1d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page