Module rsyscall.tests.test_sched

Expand source code Browse git
from rsyscall.tests.trio_test_case import TrioTestCase
from rsyscall import local_thread
from rsyscall.sched import CpuSet

class TestEventfd(TrioTestCase):
    async def asyncSetUp(self) -> None:
        self.thr = local_thread

    async def test(self) -> None:
        avail = await (await self.thr.task.sched_getaffinity(await self.thr.malloc(CpuSet))).read()
        with self.assertRaises(OSError, msg="calling setaffinity with an empty set should fail"):
            await self.thr.task.sched_setaffinity(await self.thr.ptr(CpuSet()))
        await self.thr.task.sched_setaffinity(await self.thr.ptr(CpuSet([list(avail)[0]])))
        await self.thr.task.sched_setaffinity(await self.thr.ptr(avail))

Classes

class TestEventfd (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 TestEventfd(TrioTestCase):
    async def asyncSetUp(self) -> None:
        self.thr = local_thread

    async def test(self) -> None:
        avail = await (await self.thr.task.sched_getaffinity(await self.thr.malloc(CpuSet))).read()
        with self.assertRaises(OSError, msg="calling setaffinity with an empty set should fail"):
            await self.thr.task.sched_setaffinity(await self.thr.ptr(CpuSet()))
        await self.thr.task.sched_setaffinity(await self.thr.ptr(CpuSet([list(avail)[0]])))
        await self.thr.task.sched_setaffinity(await self.thr.ptr(avail))

Ancestors

Class variables

var nursery : trio.Nursery

Methods

async def test(self) ‑> NoneType
Expand source code Browse git
async def test(self) -> None:
    avail = await (await self.thr.task.sched_getaffinity(await self.thr.malloc(CpuSet))).read()
    with self.assertRaises(OSError, msg="calling setaffinity with an empty set should fail"):
        await self.thr.task.sched_setaffinity(await self.thr.ptr(CpuSet()))
    await self.thr.task.sched_setaffinity(await self.thr.ptr(CpuSet([list(avail)[0]])))
    await self.thr.task.sched_setaffinity(await self.thr.ptr(avail))

Inherited members