Buckets:

download
raw
1.04 kB
"""Shared fixtures for opencloning-cli smoke tests."""
from __future__ import annotations
import os
import tempfile
from pathlib import Path
from typing import Generator
import pytest
from opencloning_db.config import Config, _peek_config
import opencloning_db.db as db_module
_TEST_DATABASE_URL = os.environ.get(
'OPENCLONING_TEST_DATABASE_URL',
'postgresql+psycopg://dbuser:dbpassword@localhost:5432/opencloning_test',
)
@pytest.fixture
def temp_workspace() -> Generator[tuple[Path, Config], None, None]:
"""Yield ``(workspace_dir, config)`` pointing at a temp test workspace."""
default_config = _peek_config()
config = Config(
database_url=_TEST_DATABASE_URL,
jwt_secret='test-jwt-secret-not-for-production',
registration_whitelist_enabled=False,
)
db_module.reset_runtime_state(config)
with tempfile.TemporaryDirectory(prefix='opencloning-cli-test-') as tmp:
workspace = Path(tmp)
yield workspace, config
db_module.reset_runtime_state(default_config)

Xet Storage Details

Size:
1.04 kB
·
Xet hash:
3a9c6351315dba6370cfdf38d26e7d7c833532175f5d9da69e51f9089f937b8c

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.