Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
6 changes: 6 additions & 0 deletions testing/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,11 @@ classifiers = [
"Homepage" = "https://github.com/canonical/operator"
"Bug Tracker" = "https://github.com/canonical/operator/issues"

[dependency-groups]
unit = [
"ops-tracing",
"pytest~=9.0",
]

[tool.hatch.build.targets.wheel]
packages = ["src/scenario"] # Hatch looks for 'ops_scenario' by default.
2 changes: 2 additions & 0 deletions testing/tests/benchmark/test_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import ops
from ops import testing

pytest.importorskip('pytest_benchmark') # Provides the 'benchmark' fixture.


@pytest.fixture
def benchmark_charm():
Expand Down
9 changes: 5 additions & 4 deletions testing/tests/test_e2e/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from __future__ import annotations

import pathlib
from collections.abc import Generator
from typing import Any

Expand All @@ -19,8 +20,8 @@ def secrets_context(secrets_charm_meta: dict[str, Any]):


@pytest.fixture
def secrets_charm_meta(pytestconfig: pytest.Config) -> Generator[dict[str, Any]]:
def secrets_charm_meta() -> Generator[dict[str, Any]]:
"""Metadata for the secret test charm."""
return yaml.safe_load(
(pytestconfig.rootpath / 'test/charms/test_secrets/charmcraft.yaml').read_text()
)
# The repository root, so the path doesn't depend on pytest's rootdir.
root = pathlib.Path(__file__).parents[3]
return yaml.safe_load((root / 'test/charms/test_secrets/charmcraft.yaml').read_text())
3 changes: 3 additions & 0 deletions testing/tests/test_e2e/test_trace_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@

from __future__ import annotations

import pytest
from scenario import Context, State

import ops

pytest.importorskip('ops_tracing')

META = {
'name': 'traced_charm',
'requires': {'charm-tracing': {'interface': 'tracing', 'limit': 1}},
Expand Down
2 changes: 1 addition & 1 deletion tracing/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ lint = [
"pyright~=1.1",
]
unit = [
"ops[testing]",
"ops-scenario",
"pytest~=9.0",
]

Expand Down
16 changes: 14 additions & 2 deletions uv.lock

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

Loading