veilid/veilid-python/tests/conftest.py
DumontIO c92e07c88e Python code cleanup
These changes should not change any functionality.

In code:

- Added async keyword to CryptoSystem::kind since it's actually implemented async
- Removed unused socket import in json_api

In tests:
- Removed unused imports
- Removed unnecessary return statements
- Removed unused variables
- Cleaned up some spacing to match PEP-8
- Changed many comparisons to match PEP-8
- Use ValueSubKey classes instead of integers to keep types in line
2024-08-13 16:47:06 -04:00

31 lines
695 B
Python

"""Common test fixtures."""
from typing import AsyncGenerator
import pytest
import pytest_asyncio
import veilid
from veilid.json_api import _JsonVeilidAPI
pytest_plugins = ("pytest_asyncio",)
async def simple_update_callback(update: veilid.VeilidUpdate):
print(f"VeilidUpdate: {update}")
@pytest_asyncio.fixture
async def api_connection() -> AsyncGenerator[_JsonVeilidAPI, None]:
try:
api = await veilid.api_connector(simple_update_callback)
except veilid.VeilidConnectionError:
pytest.skip("Unable to connect to veilid-server.")
async with api:
# purge routes to ensure we start fresh
await api.debug("purge routes")
yield api