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
3 changes: 2 additions & 1 deletion revup/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def _main() -> None:
# https://stackoverflow.com/questions/63860576/asyncio-event-loop-is-closed-when-using-asyncio-run
# Since revup makes use of subprocess, we can't use WindowsSelectorEventLoopPolicy.
# Instead, we can manually create the event loop and prevent the RuntimeError on shutdown.
sys.exit(asyncio.get_event_loop().run_until_complete(main()))
loop = asyncio.new_event_loop()
sys.exit(loop.run_until_complete(main()))
except RevupUsageException as e:
logging.error(str(e))
sys.exit(2)
Expand Down
5 changes: 1 addition & 4 deletions tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ def mock_revup(args, user_input) -> str:
with mock.patch.object(sys, "argv", args):
with mock.patch.object(builtins, "input", lambda x: user_input.pop(0)):
with mock.patch("sys.stdout", new_callable=io.StringIO):
# Ensure we finish main.
loop = asyncio.get_event_loop()
coroutine = revup.main()
loop.run_until_complete(coroutine)
asyncio.run(revup.main())
output = sys.stdout.getvalue()

# This is the stdout output.
Expand Down
Loading