aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2023-01-01 17:37:01 -0500
committerEli Schwartz <eschwartz@archlinux.org>2023-01-04 16:46:51 -0500
commit56312c057938237671524f49c5206e2a98be7863 (patch)
tree7729865d46d64d3c6a96ed5da912522a926b01fc /mesonbuild
parent9aff189e315ccbe3444c75aef412d311fa95fcd2 (diff)
downloadmeson-56312c057938237671524f49c5206e2a98be7863.zip
meson-56312c057938237671524f49c5206e2a98be7863.tar.gz
meson-56312c057938237671524f49c5206e2a98be7863.tar.bz2
mtest: delay creation of asyncio lock until event loop exists
In https://bugs.python.org/issue42392 this stopped implicitly creating an event loop if none exists. We created it before running _run_tests(), so it would auto-create an event loop and set the default, which means we cannot create one explicitly on our own schedule or we end up with two of them. Delay this until we actually start the logger. This happens inside the actual testsuite loop, so it finds the running loop and doesn't create a new one, even on python <3.10.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/mtest.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py
index bcf84d3..b398705 100644
--- a/mesonbuild/mtest.py
+++ b/mesonbuild/mtest.py
@@ -502,7 +502,9 @@ class ConsoleLogger(TestLogger):
self.progress_task = None # type: T.Optional[asyncio.Future]
self.max_left_width = 0 # type: int
self.stop = False
- self.update = asyncio.Event()
+ # TODO: before 3.10 this cannot be created immediately, because
+ # it will create a new event loop
+ self.update: asyncio.Event
self.should_erase_line = ''
self.test_count = 0
self.started_tests = 0
@@ -600,6 +602,7 @@ class ConsoleLogger(TestLogger):
self.emit_progress(harness)
self.flush()
+ self.update = asyncio.Event()
self.test_count = harness.test_count
self.cols = max(self.cols, harness.max_left_width + 30)