Module rsyscall.tests.test_stdinboot

Expand source code Browse git
from __future__ import annotations

from rsyscall.tests.trio_test_case import TrioTestCase
from rsyscall.nix import local_store
from rsyscall.tasks.stdin_bootstrap import *

from rsyscall import local_thread

from rsyscall.tests.utils import do_async_things
from rsyscall.command import Command

class TestStdinboot(TrioTestCase):
    async def asyncSetUp(self) -> None:
        self.local = local_thread
        path = await stdin_bootstrap_path_from_store(local_store)
        self.command = Command(path, ['rsyscall-stdin-bootstrap'], {})
        self.local_child, self.remote = await stdin_bootstrap(self.local, self.command)

    async def asyncTearDown(self) -> None:
        await self.local_child.kill()

    async def test_exit(self) -> None:
        await self.remote.exit(0)

    async def test_async(self) -> None:
        await do_async_things(self, self.remote.epoller, self.remote)

    async def test_nest(self) -> None:
        child, new_thread = await stdin_bootstrap(self.remote, self.command)
        async with child:
            await do_async_things(self, new_thread.epoller, new_thread)

    async def test_nest_multiple(self) -> None:
        for i in range(5):
            child = await self.remote.clone()
            await do_async_things(self, child.epoller, child)
            await child.exit(0)

Classes

class TestStdinboot (methodName='runTest')

A trio-enabled variant of unittest.TestCase

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

Expand source code Browse git
class TestStdinboot(TrioTestCase):
    async def asyncSetUp(self) -> None:
        self.local = local_thread
        path = await stdin_bootstrap_path_from_store(local_store)
        self.command = Command(path, ['rsyscall-stdin-bootstrap'], {})
        self.local_child, self.remote = await stdin_bootstrap(self.local, self.command)

    async def asyncTearDown(self) -> None:
        await self.local_child.kill()

    async def test_exit(self) -> None:
        await self.remote.exit(0)

    async def test_async(self) -> None:
        await do_async_things(self, self.remote.epoller, self.remote)

    async def test_nest(self) -> None:
        child, new_thread = await stdin_bootstrap(self.remote, self.command)
        async with child:
            await do_async_things(self, new_thread.epoller, new_thread)

    async def test_nest_multiple(self) -> None:
        for i in range(5):
            child = await self.remote.clone()
            await do_async_things(self, child.epoller, child)
            await child.exit(0)

Ancestors

Class variables

var nursery : trio.Nursery

Methods

async def test_exit(self) ‑> NoneType
Expand source code Browse git
async def test_exit(self) -> None:
    await self.remote.exit(0)
async def test_async(self) ‑> NoneType
Expand source code Browse git
async def test_async(self) -> None:
    await do_async_things(self, self.remote.epoller, self.remote)
async def test_nest(self) ‑> NoneType
Expand source code Browse git
async def test_nest(self) -> None:
    child, new_thread = await stdin_bootstrap(self.remote, self.command)
    async with child:
        await do_async_things(self, new_thread.epoller, new_thread)
async def test_nest_multiple(self) ‑> NoneType
Expand source code Browse git
async def test_nest_multiple(self) -> None:
    for i in range(5):
        child = await self.remote.clone()
        await do_async_things(self, child.epoller, child)
        await child.exit(0)

Inherited members