Skip to content

How to run and write tests

Run the test suite and add tests for new behaviour in ezqt-widgets.

๐Ÿ”ง Prerequisites

๐Ÿงช Run the full test suite

uv run pytest

You should see a summary showing all tests passed.

๐Ÿ“Š Run with coverage

uv run pytest --cov=src/ --cov-report=term-missing

โœ๏ธ Write a new test

  1. Create a test file in tests/ following the naming convention test_<module>.py.

  2. Write your test using pytest conventions.

from PySide6.QtWidgets import QApplication
from ezqt_widgets import IconButton

def test_icon_button_default_text():
    app = QApplication.instance() or QApplication([])
    btn = IconButton(text="Hello")
    assert btn is not None
  1. Run the test in isolation to verify it passes.
uv run pytest tests/test_<module>.py -v

โœ… Result

All tests pass and coverage remains above the configured threshold.