コード例 #1
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
コード例 #2
0
ファイル: test_aio.py プロジェクト: hynek/prometheus_async
    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
コード例 #3
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
コード例 #4
0
ファイル: test_aio.py プロジェクト: hynek/prometheus_async
    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
コード例 #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