public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: repoman/bin/, repoman/pym/repoman/tests/
@ 2018-05-16 23:29 Zac Medico
  0 siblings, 0 replies; only message in thread
From: Zac Medico @ 2018-05-16 23:29 UTC (permalink / raw
  To: gentoo-commits

commit:     b414df90b50aaf73dda3708680c6951e7dc8bad9
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed May 16 23:28:13 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed May 16 23:28:13 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=b414df90

repoman: explicitly close event loops (bug 654390)

The default asyncio event loop triggers a resource warning if it
is not explicitly closed, therefore close it when appropriate.

Bug: https://bugs.gentoo.org/654390

 repoman/bin/repoman                   | 3 +++
 repoman/pym/repoman/tests/runTests.py | 6 +++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/repoman/bin/repoman b/repoman/bin/repoman
index 7084ff918..ab04d56ca 100755
--- a/repoman/bin/repoman
+++ b/repoman/bin/repoman
@@ -38,6 +38,7 @@ if osp.isfile(osp.join(osp.dirname(osp.dirname(here)), ".repoman_not_installed")
 
 import portage
 portage._internal_caller = True
+from portage.util._eventloop.global_event_loop import global_event_loop
 from repoman.main import repoman_main
 
 try:
@@ -48,3 +49,5 @@ except IOError as e:
 		sys.exit(1)
 	else:
 		raise
+finally:
+	global_event_loop().close()

diff --git a/repoman/pym/repoman/tests/runTests.py b/repoman/pym/repoman/tests/runTests.py
index b0e715ec6..ed73592a1 100644
--- a/repoman/pym/repoman/tests/runTests.py
+++ b/repoman/pym/repoman/tests/runTests.py
@@ -45,6 +45,7 @@ portage._internal_caller = True
 # Ensure that we don't instantiate portage.settings, so that tests should
 # work the same regardless of global configuration file state/existence.
 portage._disable_legacy_globals()
+from portage.util._eventloop.global_event_loop import global_event_loop
 
 if os.environ.get('NOCOLOR') in ('yes', 'true'):
 	portage.output.nocolor()
@@ -66,4 +67,7 @@ if insert_bin_path:
 	os.environ["PATH"] = ":".join(path)
 
 if __name__ == "__main__":
-	sys.exit(tests.main())
+	try:
+		sys.exit(tests.main())
+	finally:
+		global_event_loop().close()


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-05-16 23:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-16 23:29 [gentoo-commits] proj/portage:master commit in: repoman/bin/, repoman/pym/repoman/tests/ Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox