Ejemplo
pytest-asyncio 1.4.0: pytest.mark.asyncio, pytest_asyncio.fixture, pytest_asyncio.is_async_test
Muestra verificada para pypi pytest-asyncio 1.4.0: pytest.mark.asyncio, pytest_asyncio.fixture, pytest_asyncio.is_async_test. El contrato se ejecutó en…
sha256:c6213c0528aae941777634d4ec531097bc4a65164fe99abb50e50b52dc99865a
Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido.
Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas.
MIT-0
Evidencia de ejecución
El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.
- Base de evidencia
- Contrato firmado aprobado
- Recibos de verificación
- 1
- Claves de firma que lo compilaron
- 1
Entorno declarado
python 3.12 linux 24 · alpine · musl x64 python 3.12 python pip 24
Entornos de las ejecuciones de verificación
| Entorno | Contrato | Etapas | Ejecución |
|---|---|---|---|
| python 3.12 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · python@1python:3.12-alpine@sha256:d09d15e60962… |
2026-08-27 |
Caso
HOW- Objetivo
- verify pkg:pypi/pytest-asyncio@1.4.0
- Paquetes
- Símbolos
-
- pytest.mark.asyncio
- pytest_asyncio.fixture
- pytest_asyncio.is_async_test
- Entorno
- python 3.12
- Creado
- 2026-08-27T19:42:47Z
Contrato
- pytest.mark.asyncio marks coroutine functions with asyncio marker
- pytest_asyncio.fixture decorator creates asynchronous fixture definitions
- pytest_asyncio.is_async_test verifies whether a test item is a PytestAsyncioFunction
- pytest.main executes async test suites with async fixtures and returns ExitCode.OK
- async generator fixtures execute setup before test and teardown after test execution
Archivos
- PROMPT.md
- csx.json
- pyproject.toml
- requirements.txt
- spec.json
- test/contract.py
Código fuente
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify pkg:pypi/pytest-asyncio@1.4.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:pypi/pytest-asyncio@1.4.0
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@10.9.8
- runtime: node@22.23.2
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:50f5f5697ecdecc5d90d1eaabcb6b765073399fa78d32dc1ba1f162582419224","constraints":{"executionContext":"python"},"contract":["pytest.mark.asyncio marks coroutine functions with asyncio marker","pytest_asyncio.fixture decorator creates asynchronous fixture definitions","pytest_asyncio.is_async_test verifies whether a test item is a PytestAsyncioFunction","pytest.main executes async test suites with async fixtures and returns ExitCode.OK","async generator fixtures execute setup before test and teardown after test execution"],"goal":"verify pkg:pypi/pytest-asyncio@1.4.0","kind":"HOW","packages":["pkg:pypi/pytest-asyncio@1.4.0"],"schemaVersion":1,"symbols":["pytest.mark.asyncio","pytest_asyncio.fixture","pytest_asyncio.is_async_test"]},"contractCommand":["python3","test/contract.py"],"environment":{"arch":"x64","distro":"alpine","ecosystem":"pypi","executionContext":"python","language":"python","libc":"musl","moduleSystem":"standard","os":"linux","osVersionBucket":"24","packageManager":"pip","packageManagerVersion":"24.0","runtime":"python","runtimeVersion":"3.12","schemaVersion":1},"license":"MIT-0","packages":["pkg:pypi/pytest-asyncio@1.4.0"],"schemaVersion":1,"subject":"pkg:pypi/pytest-asyncio@1.4.0","symbols":["pytest.mark.asyncio","pytest_asyncio.fixture","pytest_asyncio.is_async_test"],"verifierAdapter":"python@1"}
[project]
name = "verify-pytest-asyncio"
version = "0.1.0"
dependencies = [
"iniconfig==2.3.0",
"packaging==26.3",
"pluggy==1.6.0",
"pygments==2.21.0",
"pytest==9.1.1",
"typing-extensions==4.12.2",
"pytest-asyncio==1.4.0",
]
iniconfig==2.3.0
packaging==26.3
pluggy==1.6.0
pygments==2.21.0
pytest==9.1.1
typing-extensions==4.12.2
pytest-asyncio==1.4.0
{
"schemaVersion": 1,
"goal": "verify pkg:pypi/pytest-asyncio@1.4.0",
"kind": "HOW",
"packages": [
"pkg:pypi/pytest-asyncio@1.4.0"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
import asyncio
import inspect
import os
import sys
import tempfile
import pytest
import pytest_asyncio
from pytest_asyncio.plugin import PytestAsyncioFunction
def test_mark_asyncio():
@pytest.mark.asyncio
async def sample_async_test():
await asyncio.sleep(0.001)
return 42
assert hasattr(sample_async_test, "pytestmark")
mark_names = [m.name for m in sample_async_test.pytestmark]
assert "asyncio" in mark_names
def test_fixture_decorator():
@pytest_asyncio.fixture
async def sample_async_fixture():
await asyncio.sleep(0.001)
return "fixture_value"
assert callable(sample_async_fixture)
assert sample_async_fixture.__name__ == "sample_async_fixture"
def test_is_async_test():
class DummySyncItem:
pass
assert issubclass(PytestAsyncioFunction, object)
assert pytest_asyncio.is_async_test(DummySyncItem()) is False
def test_pytest_main_executes_async_suite():
test_code = """import asyncio
import pytest
import pytest_asyncio
@pytest_asyncio.fixture
async def async_resource():
yield "ready"
@pytest.mark.asyncio
async def test_async_function(async_resource):
assert async_resource == "ready"
await asyncio.sleep(0.001)
assert 1 + 1 == 2
"""
with tempfile.TemporaryDirectory() as tmp_dir:
test_file = os.path.join(tmp_dir, "test_async_suite.py")
with open(test_file, "w", encoding="utf-8") as f:
f.write(test_code)
exit_code = pytest.main(["-q", "--no-header", "-p", "pytest_asyncio", test_file])
assert exit_code == pytest.ExitCode.OK
def test_async_generator_fixture_lifecycle():
test_code = """import asyncio
import pytest
import pytest_asyncio
lifecycle_events = []
@pytest_asyncio.fixture
async def managed_resource():
lifecycle_events.append("setup")
yield {"status": "ok"}
lifecycle_events.append("teardown")
@pytest.mark.asyncio
async def test_lifecycle(managed_resource):
assert managed_resource["status"] == "ok"
lifecycle_events.append("running")
await asyncio.sleep(0.001)
def test_verify_lifecycle_ran():
assert lifecycle_events == ["setup", "running", "teardown"]
"""
with tempfile.TemporaryDirectory() as tmp_dir:
test_file = os.path.join(tmp_dir, "test_lifecycle.py")
with open(test_file, "w", encoding="utf-8") as f:
f.write(test_code)
exit_code = pytest.main(["-q", "--no-header", "-p", "pytest_asyncio", test_file])
assert exit_code == pytest.ExitCode.OK
def main():
test_mark_asyncio()
test_fixture_decorator()
test_is_async_test()
test_pytest_main_executes_async_suite()
test_async_generator_fixture_lifecycle()
print("All contract assertions passed.")
if __name__ == "__main__":
main()
Seeder de origen
anónimo