Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion craft_cli/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@
from typing import TYPE_CHECKING, Any, Literal
from unittest.mock import call

import pytest
try:
import pytest
except ImportError as err:
raise ImportError(
"craft-cli's pytest plugin requires pytest; install it with 'craft-cli[pytest]'"
) from err
Comment thread
bepri marked this conversation as resolved.
Comment thread
bepri marked this conversation as resolved.
from typing_extensions import Self

from craft_cli import messages, printer
Expand Down
7 changes: 7 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,17 @@ included in each version.
3.4.2 (unreleased)
------------------

New features:

- Add an optional ``pytest`` dependency group (``craft-cli[pytest]``) to track
the minimum pytest version required by the ``emitter`` test plugin.

Bug fixes:

- The ``emitter`` test fixture now rejects a negative ``advance`` amount,
matching the behavior of the real progress bar.
- The ``emitter`` test plugin now reports a clear, actionable error message
when pytest is not installed, instead of a bare ``ModuleNotFoundError``.

.. _release-3.4.1:

Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ Issues = "https://github.com/canonical/craft-cli/issues"
[project.entry-points.pytest11]
emitter = "craft_cli.pytest_plugin"

[project.optional-dependencies]
pytest = ["pytest>=8.4"]

[dependency-groups]
dev = [
"coverage[toml]==7.16.2",
Expand Down
9 changes: 8 additions & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading