diff --git a/pyproject.toml b/pyproject.toml index 253924d0..59986c60 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ license.text = "Apache-2.0" keywords = ["juju", "test"] dependencies = [ - "ops~=2.17", + "ops~=2.15", "PyYAML>=6.0.1", ] readme = "README.md" diff --git a/scenario/context.py b/scenario/context.py index 4f4e409b..26665c06 100644 --- a/scenario/context.py +++ b/scenario/context.py @@ -27,7 +27,10 @@ ) if TYPE_CHECKING: # pragma: no cover - from ops._private.harness import ExecArgs + try: + from ops._private.harness import ExecArgs # type: ignore + except ImportError: + from ops.testing import ExecArgs # type: ignore from scenario.ops_main_mock import Ops from scenario.state import ( @@ -499,7 +502,7 @@ def __init__( self.charm_root = charm_root self.juju_version = juju_version if juju_version.split(".")[0] == "2": - logger.warn( + logger.warning( "Juju 2.x is closed and unsupported. You may encounter inconsistencies.", ) diff --git a/scenario/mocking.py b/scenario/mocking.py index 99b5d768..d3ec6e20 100644 --- a/scenario/mocking.py +++ b/scenario/mocking.py @@ -22,7 +22,12 @@ ) from ops import JujuVersion, pebble -from ops._private.harness import ExecArgs, _TestingPebbleClient + +try: + from ops._private.harness import ExecArgs, _TestingPebbleClient # type: ignore +except ImportError: + from ops.testing import ExecArgs, _TestingPebbleClient # type: ignore + from ops.model import CloudSpec as CloudSpec_Ops from ops.model import ModelError from ops.model import Port as Port_Ops diff --git a/tox.ini b/tox.ini index bfe802f1..d3155731 100644 --- a/tox.ini +++ b/tox.ini @@ -43,7 +43,7 @@ commands = description = Static typing checks. skip_install = true deps = - ops~=2.17 + ops~=2.15 pyright==1.1.347 commands = pyright scenario