def test_coroutine(self, fg):
        """
        Incs and decs.
        """
        f = aio.track_inprogress(fg)(coro)

        yield from f()

        assert 0 == fg._val
        assert 2 == fg._calls
Beispiel #2
0
    def test_coroutine(self, fg):
        """
        Incs and decs.
        """
        f = aio.track_inprogress(fg)(coro)

        yield from f()

        assert 0 == fg._val
        assert 2 == fg._calls
    def test_future(self, fg, event_loop):
        """
        Incs and decs.
        """
        fut = asyncio.Future(loop=event_loop)

        wrapped = aio.track_inprogress(fg, fut)

        assert 1 == fg._val

        fut.set_result(42)

        yield from wrapped

        assert 0 == fg._val
Beispiel #4
0
    def test_future(self, fg, event_loop):
        """
        Incs and decs.
        """
        fut = asyncio.Future(loop=event_loop)

        wrapped = aio.track_inprogress(fg, fut)

        assert 1 == fg._val

        fut.set_result(42)

        yield from wrapped

        assert 0 == fg._val
Beispiel #5
0
    async def test_future(self, fg):
        """
        Incs and decs.
        """
        fut = asyncio.Future()

        wrapped = aio.track_inprogress(fg, fut)

        assert 1 == fg._val

        fut.set_result(42)

        await wrapped

        assert 0 == fg._val