diff --git a/debian/control b/debian/control index d00014b2..e133c907 100644 --- a/debian/control +++ b/debian/control @@ -67,10 +67,10 @@ Description: . #!/usr/bin/python3 . + import asyncio import logging import sys . - from juju import loop from juju.model import Model . . @@ -107,9 +107,7 @@ Description: ws_logger = logging.getLogger('websockets.protocol') ws_logger.setLevel(logging.INFO) . - # Run the deploy coroutine in an asyncio event loop, using a helper - # that abstracts loop creation and teardown. - loop.run(deploy()) + asyncio.run(deploy()) . . if __name__ == '__main__': diff --git a/juju/loop.py b/juju/loop.py deleted file mode 100644 index fa0da6d6..00000000 --- a/juju/loop.py +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright 2023 Canonical Ltd. -# Licensed under the Apache V2, see LICENCE file for details. - -from .jasyncio import * # noqa - -import warnings - -warnings.warn( - "juju.loop module is being deprecated by 3.0, use juju._jasyncio instead", - DeprecationWarning, - stacklevel=2, -) diff --git a/tests/unit/test_loop.py b/tests/unit/test_loop.py deleted file mode 100644 index ae63e7b3..00000000 --- a/tests/unit/test_loop.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2023 Canonical Ltd. -# Licensed under the Apache V2, see LICENCE file for details. - -import asyncio -import unittest - - -class TestLoop(unittest.TestCase): - def setUp(self): - # new event loop for each test - policy = asyncio.get_event_loop_policy() - self.loop = policy.new_event_loop() - policy.set_event_loop(self.loop) - - def tearDown(self): - self.loop.close() - - async def test_run(self): - assert asyncio.get_running_loop() == self.loop - - async def _test(): - return "success" - - self.assertEqual(asyncio.run(_test()), "success") - - async def test_run_exception(self): - async def _test(): - raise ValueError() - - self.assertRaises(ValueError, asyncio.run, _test())