xiio

really simple async runtime
git clone https://git.ce9e.org/xiio.git

commit
919c743e81d34b2eba2473c60d5026d3290d0679
parent
5395e355f1325dd1a5a621148a18020615e612e6
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2026-02-26 23:31
test read/write

Diffstat

M tests.py 17 +++++++++++++++++

1 files changed, 17 insertions, 0 deletions


diff --git a/tests.py b/tests.py

@@ -1,6 +1,7 @@
    1     1 import contextlib
    2     2 import functools
    3     3 import inspect
   -1     4 import os
    4     5 import time
    5     6 import unittest
    6     7 from unittest import mock
@@ -236,3 +237,19 @@ class TestRun(XiioTestCase):
  236   237         with self.assertRaises(ValueError):
  237   238             with self.assert_duration(0.1):
  238   239                 xiio.run(foo())
   -1   240 
   -1   241     def test_pipe(self):
   -1   242         async def foo():
   -1   243             r, w = os.pipe()
   -1   244             try:
   -1   245                 return await xiio.gather([
   -1   246                     xiio.read(r, 32),
   -1   247                     xiio.writeall(w, b'Hello World'),
   -1   248                 ])
   -1   249             finally:
   -1   250                 os.close(w)
   -1   251                 os.close(r)
   -1   252 
   -1   253         with self.assert_duration(0):
   -1   254             result = xiio.run(foo())
   -1   255         self.assertEqual(result, [b'Hello World', None])