Module rsyscall.tests.test_timerfd

Expand source code Browse git
from rsyscall.tests.trio_test_case import TrioTestCase
from rsyscall import local_thread
from rsyscall.sys.timerfd import *

class TestTimerfd(TrioTestCase):
    async def asyncSetUp(self) -> None:
        self.thr = local_thread
        self.fd = await self.thr.task.timerfd_create(CLOCK.REALTIME)

    async def asyncTearDown(self) -> None:
        await self.fd.close()

    async def test(self) -> None:
        await self.fd.timerfd_settime(
            TFD_TIMER.NONE, await self.thr.ram.ptr(Itimerspec(Timespec(0, 0), Timespec(0, 1))))
        await self.fd.timerfd_gettime(await self.thr.ram.malloc(Itimerspec))

Classes

class TestTimerfd (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 TestTimerfd(TrioTestCase):
    async def asyncSetUp(self) -> None:
        self.thr = local_thread
        self.fd = await self.thr.task.timerfd_create(CLOCK.REALTIME)

    async def asyncTearDown(self) -> None:
        await self.fd.close()

    async def test(self) -> None:
        await self.fd.timerfd_settime(
            TFD_TIMER.NONE, await self.thr.ram.ptr(Itimerspec(Timespec(0, 0), Timespec(0, 1))))
        await self.fd.timerfd_gettime(await self.thr.ram.malloc(Itimerspec))

Ancestors

Class variables

var nursery : trio.Nursery

Methods

async def test(self) ‑> NoneType
Expand source code Browse git
async def test(self) -> None:
    await self.fd.timerfd_settime(
        TFD_TIMER.NONE, await self.thr.ram.ptr(Itimerspec(Timespec(0, 0), Timespec(0, 1))))
    await self.fd.timerfd_gettime(await self.thr.ram.malloc(Itimerspec))

Inherited members