{"id":44589,"library":"cocotb-test","title":"cocotb-test","description":"cocotb-test is a pytest plugin for running and testing hardware designs with cocotb. It simplifies integration of cocotb tests into Python's pytest framework. Current version is 0.2.6, released 2023-08-22. Release cadence is irregular.","status":"active","version":"0.2.6","language":"python","source_language":"en","source_url":"https://github.com/themperek/cocotb-test","tags":["cocotb","pytest","hardware verification","HDL simulation"],"install":[{"cmd":"pip install cocotb-test","lang":"bash","label":"Default install"}],"dependencies":[{"reason":"Core simulation framework","package":"cocotb","optional":false},{"reason":"Test runner","package":"pytest","optional":false},{"reason":"HDL simulator (e.g., iverilog, ghdl, verilator) must be installed separately","package":"simulator","optional":true}],"imports":[{"note":"Plugin is auto-discovered by pytest; direct import of cocotb_test module is not needed for basic usage.","wrong":"","symbol":"cocotb_test","correct":"import cocotb_test"}],"quickstart":{"code":"import cocotb\nfrom cocotb.clock import Clock\nfrom cocotb.triggers import RisingEdge\n\n@cocotb.test()\nasync def test_basic(dut):\n    clock = Clock(dut.clk, 10, units='us')\n    cocotb.start_soon(clock.start())\n    dut.rst.value = 1\n    await RisingEdge(dut.clk)\n    dut.rst.value = 0\n    await RisingEdge(dut.clk)\n    assert dut.q.value == 0","lang":"python","description":"Basic cocotb test example. Run with: pytest tests/ -v"},"warnings":[{"fix":"Install a supported simulator and ensure it is in your PATH. For example, on Ubuntu: sudo apt install iverilog","message":"cocotb-test requires a hardware simulator (e.g., Icarus Verilog, Verilator, GHDL) installed and on PATH. If tests hang or fail with 'simulator not found', check your simulation tool installation.","severity":"gotcha","affected_versions":"all"},{"fix":"Pin pytest<8.0 in your requirements: pytest<8.0","message":"Version 0.2.6 does not support pytest 8.0+ properly due to internal changes in pytest's plugin discovery. If you see errors like 'Unknown hook: pytest_configure', pin pytest to <8.0.","severity":"deprecated","affected_versions":"<=0.2.6"},{"fix":"Simply install cocotb-test and run 'pytest' in your test directory; no import needed.","message":"The module 'cocotb_test' is not intended to be imported directly. Some tutorials import it but that is not required; the plugin is automatically discovered by pytest when installed.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'-08':36 '-22':37 '0.2.6':33 '2023':35 'cadenc':39 'cocotb':2,5,18,23,42 'cocotb-test':1,4 'current':30 'design':16 'framework':29 'hardwar':15,44 'hdl':46 'integr':21 'irregular':41 'plugin':10 'pytest':9,28,43 'python':26 'releas':34,38 'run':12 'simplifi':20 'simul':47 'test':3,6,14,24 'verif':45 'version':31","created_at":"2026-06-07T12:50:52.328265+00:00","updated_at":"2026-06-07T12:50:52.328265+00:00","problems":[{"fix":"Remove the import statement; the plugin is auto-discovered by pytest.","cause":"Direct import of 'cocotb_test' module is not necessary and may fail if the module path is not correct.","error":"ImportError: cannot import name 'cocotb_test' from 'cocotb_test'"},{"fix":"Ensure cocotb-test is installed (pip install cocotb-test) and use a supported pytest version (<8.0).","cause":"Running pytest without having cocotb-test installed, or using an old version of pytest that conflicts.","error":"pytest: error: unrecognized arguments: --cocotb"},{"fix":"Install the simulator (e.g., 'sudo apt install iverilog' on Ubuntu) and ensure it's in your PATH.","cause":"The required HDL simulator (e.g., iverilog) is not installed or not in PATH.","error":"OSError: [Simulator] not found"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-29","last_verified":"2026-06-29","next_check":"2026-07-29","install_tag":null}}