Files
ssw-mvp/nax/tests/conftest.py
T
admin 3247e9fd15 init: ssw-mvp initial commit
- boot/ (Java/Maven, JNPF 7.0) — 移除旧的 boot/.git,源码直接纳入仓库
- web/ (Vue 3 + Vite + Ant Design Vue, pnpm)
- docs/, scard/, nax/
- refs/INDEX.md + refs/国标/(其余 refs/* 开源子仓库不纳入)
- 已忽略: connector_data/, jweb/, log/, web/{dist,node_modules,.pnpm}, boot/*/target/, .DS_Store, .idea, .vscode
2026-08-05 18:29:12 +08:00

35 lines
695 B
Python

import os
import sys
import numpy as np
import pytest
import nax
sys.path.insert(0, os.path.dirname(__file__))
@pytest.fixture
def cluster():
"""三方本地集群,测试结束自动清理。"""
c = nax.init(["alice", "bob", "carol"], backend="local", seed=20240101)
yield c
nax.shutdown()
@pytest.fixture
def two_party():
c = nax.init(["alice", "bob"], backend="local", seed=42)
yield c
nax.shutdown()
@pytest.fixture
def box(cluster):
return nax.vault(["alice", "bob", "carol"], seed=7)
def rand(shape, seed=0, scale=4.0):
"""兼容保留:等价于 helpers.rand。"""
return np.random.default_rng(seed).uniform(-scale, scale, size=shape)