From 0851d149a211802464c4fa64bb49386fd181766b Mon Sep 17 00:00:00 2001 From: Tony Meyer Date: Thu, 18 Dec 2025 17:21:42 +1300 Subject: [PATCH 1/2] test: remove unnecessary test module. --- testing/tests/test_plugin.py | 42 ------------------------------------ 1 file changed, 42 deletions(-) delete mode 100644 testing/tests/test_plugin.py diff --git a/testing/tests/test_plugin.py b/testing/tests/test_plugin.py deleted file mode 100644 index 3c7109d6d..000000000 --- a/testing/tests/test_plugin.py +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2023 Canonical Ltd. -# See LICENSE file for licensing details. - -from __future__ import annotations - -import sys - -pytest_plugins = 'pytester' -sys.path.append('.') - - -def test_plugin_ctx_run(pytester): - # create a temporary pytest test module - pytester.makepyfile( - """ - import pytest - from scenario import State - from scenario import Context - import ops - - class MyCharm(ops.CharmBase): - pass - - @pytest.fixture - def context(): - return Context(charm_type=MyCharm, meta={"name": "foo"}) - - def test_sth(context): - context.run(context.on.start(), State()) - """ - ) - - # run pytest with the following cmd args - result = pytester.runpytest('-v') - - # fnmatch_lines does an assertion internally - result.stdout.fnmatch_lines([ - '*::test_sth PASSED*', - ]) - - # make sure that we get a '0' exit code for the testsuite - assert result.ret == 0 From 34690d067d318e09d8bc11f18b519a064d9205e4 Mon Sep 17 00:00:00 2001 From: Tony Meyer Date: Fri, 19 Dec 2025 08:33:29 +1300 Subject: [PATCH 2/2] chore: update get_filesystem methods to use Context[Any] --- testing/src/scenario/state.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/src/scenario/state.py b/testing/src/scenario/state.py index 06b2b57c6..014335c22 100644 --- a/testing/src/scenario/state.py +++ b/testing/src/scenario/state.py @@ -1139,7 +1139,7 @@ def services(self) -> dict[str, pebble.ServiceInfo]: infos[name] = info return infos - def get_filesystem(self, ctx: Context) -> pathlib.Path: + def get_filesystem(self, ctx: Context[Any]) -> pathlib.Path: """Simulated Pebble filesystem in this context. Returns: @@ -1490,7 +1490,7 @@ def __eq__(self, other: object) -> bool: return (self.name, self.index) == (other.name, other.index) return False - def get_filesystem(self, ctx: Context) -> pathlib.Path: + def get_filesystem(self, ctx: Context[Any]) -> pathlib.Path: """Simulated filesystem root in this context.""" return ctx._get_storage_root(self.name, self.index)