
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
pytest-async-generators
Advanced tools
Pytest fixtures for async generators
Invoke any async generator with await subscribe_to_messages()
and then await wait_for_messages()
to retrieve the results.
import asyncio
import pytest
from typing import AsyncGenerator, Callable
@pytest.mark.asyncio
async def test_counting(subscribe_to_messages: Callable) -> None:
async def count() -> AsyncGenerator[int, None]:
for n in range(10):
await asyncio.sleep(0.1)
yield n
subscription = await subscribe_to_messages(count())
messages = await subscription.wait_for_messages()
assert messages == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
subscribe_to_messages()
can be passed a timeout
parameter to control how long to wait for new messages.
FAQs
Pytest fixtures for async generators
We found that pytest-async-generators demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.