diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index e4808096d..0f7846fa8 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -63,15 +63,15 @@ jobs: - id: suite continue-on-error: true name: Full Python suite - run: python -m pytest tests -q -ra + run: python -m pytest tests -m cpu -q -ra - name: Collect failed test ids if: steps.suite.outcome == 'failure' - run: python -m pytest --lf --collect-only -q 2>/dev/null | grep '::' > failed-tests.txt || true + run: python -m pytest -m cpu --lf --collect-only -q 2>/dev/null | grep '::' > failed-tests.txt || true - id: rerun if: steps.suite.outcome == 'failure' continue-on-error: true name: Rerun failed subset once - run: python -m pytest --lf -q -ra + run: python -m pytest -m cpu --lf -q -ra - id: classify if: always() name: Classify outcome and probe flaky watchlist @@ -83,7 +83,7 @@ jobs: if [ "${#IDS[@]}" -gt 0 ]; then watchlist="" for run in 1 2 3; do - if python -m pytest "${IDS[@]}" -q -ra >"/tmp/watchlist-run$run.log" 2>&1; then + if python -m pytest "${IDS[@]}" -m cpu -q -ra >"/tmp/watchlist-run$run.log" 2>&1; then watchlist="$watchlist run$run=pass" else watchlist="$watchlist run$run=fail" diff --git a/.github/workflows/release-checks.yml b/.github/workflows/release-checks.yml index ee6ad3fe0..938024f25 100644 --- a/.github/workflows/release-checks.yml +++ b/.github/workflows/release-checks.yml @@ -107,7 +107,7 @@ jobs: timeout-minutes: 5 env: OPENDIRECTOR_REAL_CLI: '1' - run: python -m pytest tests/test_native_runtime.py tests/test_agent_visual_gate.py -k real_opencode -q -ra --durations=50 --junitxml=test-results/bundled-opencode.xml --ci-profile=test-results/bundled-opencode.json + run: python -m pytest tests/test_native_runtime.py tests/test_agent_visual_gate.py -k real_opencode -m cpu -q -ra --durations=50 --junitxml=test-results/bundled-opencode.xml --ci-profile=test-results/bundled-opencode.json - id: harness-install name: Install native Harness test tools if: always() && steps.install.outcome == 'success' @@ -126,14 +126,14 @@ jobs: env: OPENDIRECTOR_HARNESS_CI: '1' run: >- - python -m pytest tests/test_agent_visual_gate.py::test_harness_native_visual_input -q -ra + python -m pytest tests/test_agent_visual_gate.py::test_harness_native_visual_input -m cpu -q -ra --basetemp "$RUNNER_TEMP/harness-visual-pytest" --junitxml=test-results/harness-visual.xml --ci-profile=test-results/harness-visual.json - name: Python tests if: always() && steps.install.outcome == 'success' env: PYTEST_MARK_EXPRESSION: ${{ inputs.python-mark-expression }} - run: python -m pytest tests -q -ra -m "$PYTEST_MARK_EXPRESSION" --durations=50 --junitxml=test-results/python.xml --ci-profile=test-results/python.json + run: python -m pytest tests -q -ra -m "cpu${PYTEST_MARK_EXPRESSION:+ and ($PYTEST_MARK_EXPRESSION)}" --durations=50 --junitxml=test-results/python.xml --ci-profile=test-results/python.json - name: Check full layer inventory / 核对完整分层清单 if: always() && steps.install.outcome == 'success' && inputs.python-mark-expression == '' run: python scripts/ci/check_test_layers.py --profile test-results/python.json --require-executed diff --git a/docs/architecture/test-contracts.md b/docs/architecture/test-contracts.md index f4f73081b..66c9f32a1 100644 --- a/docs/architecture/test-contracts.md +++ b/docs/architecture/test-contracts.md @@ -41,7 +41,7 @@ Business areas under `frontend/` and `python/` may expand with coverage. Move on | --- | --- | --- | | Directory / 目录 | `frontend`, `python`, `creation`, `agent`, etc. | Organization and discovery only; never pytest CI-layer marks. / 仅组织与发现,不是 pytest CI 层 mark。 | | CI layer / CI 层 | `ready`, `merge`, `nightly` | At most one per Python case; unmarked cases remain ready during migration. PR runs ready, queue runs ready + merge, nightly runs nightly plus intentional watchlist reruns after cutover. / 每个 Python 用例至多一个;迁移期未标记仍为 ready。切换后 PR 跑 ready,队列跑 ready + merge,nightly 跑 nightly 和明确的 watchlist 重跑。 | -| Hardware platform / 机型 | Target `cpu`; accelerators and SKUs later / 目标 `cpu`,加速器与 SKU 后续 | Independent of the CI layer. Current default cases are CPU-only; registration/tagging/selection is follow-up work. Do not infer hardware from a folder or capability skip. / 与 CI 层正交;现有默认用例只需 CPU,注册、打标和筛选后续交付,不从目录或能力跳过推断机型。 | +| Hardware platform / 机型 | `cpu`; reserved `gpu` / `cuda` / `rocm` / `xpu` / `npu` / CPU 与预留加速器 | Independent of the CI layer. Current default cases explicitly declare CPU. A collection hook defaults unmarked cases to CPU before selection and rejects multiple platforms. Do not infer hardware from a folder or capability skip. / 与 CI 层正交;现有默认用例显式标 CPU;收集时在筛选前为未标记用例补 CPU,拒绝多个机型标记,不从目录或能力跳过推断机型。 | | Capability / 能力 | `requires_ffmpeg`, `requires_posix` | Skip with a reason when unavailable; not lane or hardware selectors. / 缺能力时带原因跳过,不用于分车道或分机型。 | | Browser lane / 浏览器车道 | `gate`, `extended`, `extendedFixture`, `production`, `perf`, `manual` | Only `tests/browser/manifest.json` owns membership; these are not pytest marks. / 归属只由 manifest 管理,不是 pytest mark。 | diff --git a/docs/development/ci-layer-assessment.md b/docs/development/ci-layer-assessment.md index 6275dc970..5e6ce4b85 100644 --- a/docs/development/ci-layer-assessment.md +++ b/docs/development/ci-layer-assessment.md @@ -124,3 +124,37 @@ acceptance before reducing the active full-suite bar. PR-5 只准备分类和覆盖保护。机型标记独立开发;PR-8 仍须等待机型轴与真实 合并队列验收,现有全量门槛保持不变。 + +## CPU platform axis / CPU 机型轴(2026-11-23) + +This pass starts at main `273153908edd068cde6c339a5fc98ebcbf604af9`. +The same Windows environment collected 2,994 cases before hardware tagging. +After tagging and adding 11 hardware/audit regressions, full collection and +CPU-only collection both contain 3,005 cases with zero deselections. Every old +raw ID and effective CI layer is preserved; all current cases explicitly inherit +CPU from their test module. No cross-platform ID normalization is involved. +The final partition is ready 2,936, merge 59, nightly 10. + +本轮基于上述 main。同一 Windows 环境修改前收集 2,994 项,显式机型标记及 +11 项新增回归后,全量与 CPU 筛选均收集 3,005 项,零排除。原始 ID 和原有 +CI 层级全部保持,现有用例均从测试模块显式继承 CPU,不做跨平台 ID 归一化。 +最终分类为 ready 2,936、merge 59、nightly 10。 + +Collection tests exercise migration defaults before `-m` deselection, inherited +platform conflicts (including conflicts that CPU selection would otherwise hide), +reserved accelerator isolation, and preservation of the orthogonal layer axis. +The full layer audit accepts a CPU profile only when collection is complete, +no case was deselected, and every retained case has CPU hardware evidence. + +回归通过真实 pytest 子进程检查默认值先于筛选、继承机型冲突、CPU 筛选可能 +掩盖的冲突、预留加速器隔离,以及与层级轴的正交性。完整核对仅接受完整收集、 +零排除、逐项 CPU 证据齐全的 CPU profile。 + +PR-7 live queue enforcement and PR-8 layer cutover remain separate work. +The CPU selection includes the existing full layer set, bundled native checks +and the nightly watchlist. Accelerator names are reserved; no accelerator job, +paid model call or migration of the static workflow implementation is introduced. + +PR-7 的真实队列强制验收和 PR-8 的层级切换仍独立推进。本轮 CPU 筛选保留 +所有原有层级、bundled 原生检查和 nightly watchlist;只预留加速器名称, +不新增加速器车道、付费模型调用,也不搬迁静态工作流实现。 diff --git a/docs/development/validation.md b/docs/development/validation.md index 13fce12fc..13c985ce6 100644 --- a/docs/development/validation.md +++ b/docs/development/validation.md @@ -53,9 +53,9 @@ Budgets measure stage wall time, not the sum of parallel job limits, and never j ### 过渡与必需检查 / Transition and required checks -当前 [`ci.yml`](../../.github/workflows/ci.yml) 对 PR、`merge_group: checks_requested` 和 main push 开启静态门禁;纯文档 PR / 合并组合按下方白名单跳过重检查,其余仍跑全量 Python。[`nightly.yml`](../../.github/workflows/nightly.yml) 保留 gate-parity 和全量 Python flake 分诊。已注册 CI 层 mark,安全扫描见下方独立工作流;机型轴、合并队列强制配置与 main 证据归集仍是后续交付。当前 job 限额见下方静态检查说明;PR 和队列各 30 分钟是阶段目标,不代表已强制端到端总上限。 +当前 [`ci.yml`](../../.github/workflows/ci.yml) 对 PR、`merge_group: checks_requested` 和 main push 开启静态门禁;纯文档 PR / 合并组合按下方白名单跳过重检查,其余仍跑全量 Python。[`nightly.yml`](../../.github/workflows/nightly.yml) 保留 gate-parity 和全量 Python flake 分诊。已注册 CI 层 mark,安全扫描见下方独立工作流;机型轴已注册并选择 CPU,合并队列强制配置与 main 证据归集仍是后续交付。当前 job 限额见下方静态检查说明;PR 和队列各 30 分钟是阶段目标,不代表已强制端到端总上限。 -Currently [`ci.yml`](../../.github/workflows/ci.yml) enables static checks on PRs, `merge_group: checks_requested` and main pushes. Documentation-only PRs and merge groups use the allowlist below to skip heavy checks; other changes retain full Python selection. [`nightly.yml`](../../.github/workflows/nightly.yml) retains gate parity and full-suite Python flake triage. CI-layer marks are registered. Security scanning uses the independent workflow below; hardware tagging, merge-queue enforcement and main evidence collection remain follow-up delivery. Current job limits are documented below; 30 minutes each for PR and queue are stage targets, not enforced end-to-end deadlines. +Currently [`ci.yml`](../../.github/workflows/ci.yml) enables static checks on PRs, `merge_group: checks_requested` and main pushes. Documentation-only PRs and merge groups use the allowlist below to skip heavy checks; other changes retain full Python selection. [`nightly.yml`](../../.github/workflows/nightly.yml) retains gate parity and full-suite Python flake triage. CI-layer marks are registered. Security scanning uses the independent workflow below; CPU hardware tagging and selection are active; merge-queue enforcement and main evidence collection remain follow-up delivery. Current job limits are documented below; 30 minutes each for PR and queue are stage targets, not enforced end-to-end deadlines. - 本地 hook 可未安装或被绕过,不能在 GitHub 上普遍阻止 PR 创建。必需 CI 必须复核同一配置;静态失败阻止启动重测试,并使稳定汇总检查失败。/ Local hooks can be absent or bypassed and cannot universally prevent PR creation. Required CI repeats the same configuration; static failure blocks heavy jobs and fails the stable aggregate. - 纯文档变更可跳过重 Python/浏览器任务,但必须保留稳定的必需检查,报告跳过依据并成功结束。合并队列按整个 merge-group 差异判断,不能只看最后一个 PR;无法确定范围时执行完整门禁。/ Documentation-only changes may skip heavy Python/browser jobs, but a stable required check must report the reason and succeed. Queue filtering covers the whole merge-group diff, not only its last PR; uncertain scope runs the full gate. @@ -679,3 +679,42 @@ PYTHONPATH=packages/core/src:apps/api/src python tests/browser/creation_server.p # In another terminal, with CREATION_WEB_URL / CREATION_API_URL set: node tests/browser/video_review_regressions.mjs ``` + + +### Hardware selection / 机型选择 + +Current Python test modules explicitly declare `pytest.mark.cpu`, independently +of ready/merge/nightly. The `ci_hardware` collection hook assigns CPU to unmarked +migration cases **before** mark deselection. Multiple distinct platform marks, +including inherited module/class/function marks, fail collection. Repeated CPU +marks are harmless. Reserved accelerator marks are never relabeled CPU; this +change adds no accelerator tests, jobs, credentials, or real-provider calls. + +当前 Python 模块显式标记 `cpu`,与 CI 层级正交。收集插件在 `-m` 筛选前为 +迁移期间未标记的用例补 CPU;模块、类、函数的机型标记合并后若有多个不同值, +收集失败。重复 CPU 标记允许,预留加速器用例不会被改标 CPU。本改动不新增 +加速器测试、车道、凭证或真实模型调用。 + +Release checks and nightly Python phases select `cpu`, including watchlist and +bundled CLI phases. Existing layer expressions are intersected with CPU; the +ready/merge/nightly cutover still waits for PR-7/PR-8. A CPU-only profile is +accepted by the full layer audit only with zero deselections; introducing real +non-CPU cases requires an independent full inventory and their explicit lanes. + +Release checks 与 nightly 的 Python 阶段(含 watchlist 和 bundled CLI)选择 +CPU,现有层级表达式与 CPU 取交集,尚不切换 ready/merge/nightly。完整层级核对 +仅在零排除时接受 CPU profile;未来加入非 CPU 用例时,必须配套独立完整清单 +及相应车道,不能用 CPU 子集冒充全量覆盖。 + +```sh +python -m pytest tests --collect-only -q --ci-profile=all.json +python -m pytest tests --collect-only -q -m cpu --ci-profile=cpu.json +python scripts/ci/check_test_layers.py --profile cpu.json +``` + +Compare raw test ID sets and layer assignments from both profiles. They must +match for today's all-CPU suite; neither collection proves test execution. +Timing JSON includes per-case hardware and aggregate hardware counts. + +比较两份 profile 的原始 ID 和层级;当前全 CPU 套件应完全一致,收集结果 +不代表测试执行通过。耗时 JSON 同时记录逐用例机型和机型汇总数量。 diff --git a/pyproject.toml b/pyproject.toml index 56b55d1a9..0e6aeba18 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,6 +25,12 @@ opendirector = "opendirector.cli:main" [tool.pytest.ini_options] markers = [ + "cpu: CPU-only tests; default during hardware migration", + "gpu: reserved generic GPU platform", + "cuda: reserved CUDA platform", + "rocm: reserved ROCm platform", + "xpu: reserved XPU platform", + "npu: reserved NPU platform", "ready: fast deterministic checks for PR feedback", "merge: broader stubbed integration checks for the pre-merge gate", "nightly: timing-sensitive or opt-in external-service checks", diff --git a/scripts/ci/check_test_layers.py b/scripts/ci/check_test_layers.py index ae013ad1e..62b597db9 100644 --- a/scripts/ci/check_test_layers.py +++ b/scripts/ci/check_test_layers.py @@ -14,7 +14,7 @@ def audit(profile, contract, manifest, *, require_executed=False): raise ValueError('Unsupported evidence or contract schema') scope = profile['metadata'] if (not profile.get('collection_complete') or scope.get('paths') != ['tests'] - or scope.get('selection') or scope.get('keyword') or profile['deselected_count'] + or scope.get('selection') not in ('', 'cpu') or scope.get('keyword') or profile['deselected_count'] or scope.get('ignore') or scope.get('ignore_glob')): raise ValueError('A complete, unfiltered tests/ inventory is required') cases = profile['tests'] @@ -22,6 +22,8 @@ def audit(profile, contract, manifest, *, require_executed=False): if len(ids) != len(set(ids)) or len(ids) != profile['collected_count']: raise ValueError('Duplicate or missing collected test identities') for case in cases: + if scope.get('selection') == 'cpu' and case.get('hardware') != ['cpu']: + raise ValueError('CPU inventory contains missing or non-CPU hardware: ' + case['nodeid']) layers = case['explicit_layers'] if len(layers) > 1 or not set(layers) <= LAYERS: raise ValueError('Conflicting or unknown CI layer: ' + case['nodeid']) diff --git a/tests/ci_hardware.py b/tests/ci_hardware.py new file mode 100644 index 000000000..1a0baf7b8 --- /dev/null +++ b/tests/ci_hardware.py @@ -0,0 +1,17 @@ +"""CPU migration default and independent, mutually exclusive hardware marks.""" +import pytest + +PLATFORMS = frozenset({'cpu', 'gpu', 'cuda', 'rocm', 'xpu', 'npu'}) + + +@pytest.hookimpl(tryfirst=True) +def pytest_collection_modifyitems(items): + for item in items: + platforms = {mark.name for mark in item.iter_markers() if mark.name in PLATFORMS} + if len(platforms) > 1: + raise pytest.UsageError( + 'Conflicting hardware platforms / 机型标记冲突: ' + + item.nodeid + ': ' + ', '.join(sorted(platforms))) + if not platforms: + item._ci_hardware_default = True + item.add_marker(pytest.mark.cpu) diff --git a/tests/ci_profile.py b/tests/ci_profile.py index 3e2361ad3..d42cb0229 100644 --- a/tests/ci_profile.py +++ b/tests/ci_profile.py @@ -10,6 +10,8 @@ import pytest +from ci_hardware import PLATFORMS + LAYERS = {'ready', 'merge', 'nightly'} @@ -55,7 +57,10 @@ def pytest_collection_finish(self, session): self.collected_count = len(session.items) for item in session.items: layers = sorted({mark.name for mark in item.iter_markers() if mark.name in LAYERS}) + hardware = sorted({mark.name for mark in item.iter_markers() if mark.name in PLATFORMS}) self.cases[item.nodeid] = { + 'hardware': hardware or ['cpu'], + 'hardware_migration_default': getattr(item, '_ci_hardware_default', not hardware), 'nodeid': item.nodeid, 'module': item.nodeid.split('::', 1)[0], 'explicit_layers': layers, 'effective_layer': layers[0] if len(layers) == 1 else 'ready' if not layers else 'conflict', 'migration_default': not layers, 'durations': {}, 'outcomes': {}, @@ -99,6 +104,7 @@ def write(self, *, complete, exit_status): 'counts': dict(Counter(case['outcome'] for case in cases)), 'layers': dict(Counter(case['effective_layer'] for case in cases)), 'unmarked': sum(case['migration_default'] for case in cases), + 'hardware': dict(Counter(platform for case in cases for platform in case['hardware'])), 'modules': dict(sorted(modules.items(), key=lambda pair: pair[1], reverse=True)), 'tests': cases, } diff --git a/tests/conftest.py b/tests/conftest.py index a9383aedf..427d45f80 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -7,7 +7,7 @@ import pytest import socket -pytest_plugins = ['ci_profile'] +pytest_plugins = ['ci_hardware', 'ci_profile'] from opendirector.wiring import configure_runtime diff --git a/tests/test_agent_artifacts.py b/tests/test_agent_artifacts.py index 9c8a8b8b3..20e7a5e0e 100644 --- a/tests/test_agent_artifacts.py +++ b/tests/test_agent_artifacts.py @@ -23,6 +23,9 @@ from opendirector_api.main import create_app +pytestmark = pytest.mark.cpu + + @pytest.fixture def publication(tmp_path): projects = CreationProjects(LocalProjects(tmp_path)) diff --git a/tests/test_agent_citations.py b/tests/test_agent_citations.py index 9f6284bf8..5b66ee297 100644 --- a/tests/test_agent_citations.py +++ b/tests/test_agent_citations.py @@ -8,6 +8,9 @@ from opendirector.agent.native import text_events +pytestmark = pytest.mark.cpu + + def search_result(ref='turn1search0', url='https://example.test/a', title='Source A'): return {'type': 'item.completed', 'item': {'type': 'mcp_tool_call', 'tool': 'search_service.web_run', 'status': 'completed', diff --git a/tests/test_agent_gateway.py b/tests/test_agent_gateway.py index 3dc8e4b1b..4b58f1baa 100644 --- a/tests/test_agent_gateway.py +++ b/tests/test_agent_gateway.py @@ -15,6 +15,9 @@ from opendirector.infrastructure.model_configs import ModelConfigs +pytestmark = pytest.mark.cpu + + @pytest.fixture def anyio_backend(): return 'asyncio' diff --git a/tests/test_agent_job_lineage.py b/tests/test_agent_job_lineage.py index e0fe0f3a4..f7460a505 100644 --- a/tests/test_agent_job_lineage.py +++ b/tests/test_agent_job_lineage.py @@ -25,6 +25,9 @@ from test_creation_canvas_service import media, project, send, ver # noqa: F401 (project is a fixture) +pytestmark = pytest.mark.cpu + + @pytest.fixture def anyio_backend(): return 'asyncio' diff --git a/tests/test_agent_metadata.py b/tests/test_agent_metadata.py index 67dca9e96..c5fd5b5a4 100644 --- a/tests/test_agent_metadata.py +++ b/tests/test_agent_metadata.py @@ -12,6 +12,9 @@ from opendirector.infrastructure.model_configs import ModelConfigs +pytestmark = pytest.mark.cpu + + def test_all_registered_commands_have_explicit_metadata(): for name, model in COMMAND_MODELS.items(): description = model.__dict__.get('__doc__') diff --git a/tests/test_agent_tools_voices.py b/tests/test_agent_tools_voices.py index 5d7ddeb36..7d89dbac7 100644 --- a/tests/test_agent_tools_voices.py +++ b/tests/test_agent_tools_voices.py @@ -10,6 +10,9 @@ from opendirector.domain.projects import ProjectError +pytestmark = pytest.mark.cpu + + def test_voice_list_exposes_page_options(): function = next(tool['function'] for tool in tools() if tool['function']['name'] == 'voice_list') parameters = function['parameters'] diff --git a/tests/test_agent_visual_gate.py b/tests/test_agent_visual_gate.py index fab2096a4..4ab008372 100644 --- a/tests/test_agent_visual_gate.py +++ b/tests/test_agent_visual_gate.py @@ -25,6 +25,9 @@ from visual_model_fixture import anthropic_stream, image_bytes, latest_tool_output, responses_stream, serve_model +pytestmark = pytest.mark.cpu + + COLORS = {'red': (240, 20, 20), 'blue': (20, 20, 240), 'green': (20, 200, 20), 'yellow': (240, 240, 20)} STILL = ('red', 'blue') diff --git a/tests/test_app_settings.py b/tests/test_app_settings.py index ba49dd4eb..d54ab1597 100644 --- a/tests/test_app_settings.py +++ b/tests/test_app_settings.py @@ -16,6 +16,9 @@ from opendirector_api.main import create_app +pytestmark = pytest.mark.cpu + + def test_default_and_saved_settings_survive_application_restart(tmp_path): headers = {'X-OpenDirector-Request': '1'} store = LocalProjects(tmp_path) diff --git a/tests/test_asset_names.py b/tests/test_asset_names.py index 765e7df00..bc7ee6e29 100644 --- a/tests/test_asset_names.py +++ b/tests/test_asset_names.py @@ -3,6 +3,9 @@ from opendirector.media.filenames import with_extension +pytestmark = pytest.mark.cpu + + @pytest.mark.parametrize(('name', 'suffix', 'expected'), [ ('原版', 'mp4', '原版.mp4'), ('原版.mp4', 'mp4', '原版.mp4'), diff --git a/tests/test_assistant_capability_parameters.py b/tests/test_assistant_capability_parameters.py index 147033d52..9ca3ef0bd 100644 --- a/tests/test_assistant_capability_parameters.py +++ b/tests/test_assistant_capability_parameters.py @@ -17,6 +17,9 @@ from test_model_availability import document, NOW +pytestmark = pytest.mark.cpu + + @pytest.mark.parametrize('locale', ['en-US', 'zh-CN']) @pytest.mark.parametrize('scenario', [ 'limited', 'boundary', 'above', 'expired', 'unknown', 'unknown_with_limit', 'missing', 'failed', diff --git a/tests/test_assistant_conversation_trace.py b/tests/test_assistant_conversation_trace.py index 6a236a24c..a78eecea2 100644 --- a/tests/test_assistant_conversation_trace.py +++ b/tests/test_assistant_conversation_trace.py @@ -1,9 +1,14 @@ + +import pytest import json from uuid import uuid4 from test_assistant_conversations import assistant, send # noqa: F401 +pytestmark = pytest.mark.cpu + + def conversation_file(tmp_path): return next(tmp_path.rglob('agent-runs/conversation.json')) diff --git a/tests/test_assistant_conversations.py b/tests/test_assistant_conversations.py index daa54dba4..fac0fa4c2 100644 --- a/tests/test_assistant_conversations.py +++ b/tests/test_assistant_conversations.py @@ -12,6 +12,9 @@ from opendirector_api import agent +pytestmark = pytest.mark.cpu + + def frames(response): return [json.loads(line[6:]) for line in response.text.splitlines() if line.startswith('data: ')] diff --git a/tests/test_atlascloud.py b/tests/test_atlascloud.py index 72ae867ee..e021aafb9 100644 --- a/tests/test_atlascloud.py +++ b/tests/test_atlascloud.py @@ -1,7 +1,12 @@ """Atlas Cloud chat requests send reasoning_effort only at the level every model family accepts.""" + +import pytest from opendirector.integrations.chat_completions import chat_payload +pytestmark = pytest.mark.cpu + + ATLAS = {"modelId": "deepseek-ai/deepseek-v4-flash", "url": "https://api.atlascloud.ai/v1"} diff --git a/tests/test_bench_creation_projects.py b/tests/test_bench_creation_projects.py index 676e82b32..1af202c98 100644 --- a/tests/test_bench_creation_projects.py +++ b/tests/test_bench_creation_projects.py @@ -5,11 +5,16 @@ ``LocalProjects.LEASE_SECONDS`` (#260). These tests shrink the lease so the same ratio is exercised without waiting a minute. """ + +import pytest import importlib.util from pathlib import Path from opendirector.infrastructure.local_projects import LocalProjects + +pytestmark = pytest.mark.cpu + ROOT = Path(__file__).resolve().parents[1] SCRIPT = ROOT / 'scripts/bench_creation_projects.py' diff --git a/tests/test_bigmodel_image.py b/tests/test_bigmodel_image.py index 8eceeb321..1565611b3 100644 --- a/tests/test_bigmodel_image.py +++ b/tests/test_bigmodel_image.py @@ -25,6 +25,9 @@ from test_creation_canvas_service import send, ver +pytestmark = pytest.mark.cpu + + SECRET = 'bigmodel-private-test-key' URL = 'https://93.184.216.34/output?signature=private-result' CONFIG = dict(kind='image', url='https://open.bigmodel.cn/api/paas/v4', modelId='glm-image', diff --git a/tests/test_bigmodel_video.py b/tests/test_bigmodel_video.py index 142b1a29f..493101053 100644 --- a/tests/test_bigmodel_video.py +++ b/tests/test_bigmodel_video.py @@ -28,6 +28,9 @@ from generation_helpers import command, new_project, prepared, settled from test_creation_canvas_service import send, ver + +pytestmark = pytest.mark.cpu + SECRET = 'synthetic-bigmodel-video-secret' URL = 'https://cdn.test/video.mp4?signature=private-result' CONFIG = dict(kind='video', modelId='cogvideox-3', protocol='bigmodel_video', diff --git a/tests/test_canvas_sources.py b/tests/test_canvas_sources.py index 747c074f1..510ba213c 100644 --- a/tests/test_canvas_sources.py +++ b/tests/test_canvas_sources.py @@ -21,6 +21,9 @@ from test_subject_library import register_image +pytestmark = pytest.mark.cpu + + def canvas_source(store, kind='image', payload=None): projects, owner, session = new_project(store.repository, 'Canvas source') assets = CreationToolAssets(projects) diff --git a/tests/test_canvas_text_cli.py b/tests/test_canvas_text_cli.py index 2570150a2..3922ff46e 100644 --- a/tests/test_canvas_text_cli.py +++ b/tests/test_canvas_text_cli.py @@ -20,6 +20,9 @@ from opendirector_api.main import create_app +pytestmark = pytest.mark.cpu + + @pytest.fixture(params=['http', 'live'], ids=['http-testclient', 'live-bridge-only']) def canvas_cli(request, tmp_path, monkeypatch): local = LocalProjects(tmp_path) diff --git a/tests/test_canvas_text_cli_http.py b/tests/test_canvas_text_cli_http.py index c2df057c5..64e297cf7 100644 --- a/tests/test_canvas_text_cli_http.py +++ b/tests/test_canvas_text_cli_http.py @@ -24,6 +24,9 @@ from opendirector_api.main import create_app +pytestmark = pytest.mark.cpu + + @pytest.mark.merge @pytest.mark.parametrize('listening', [True, False], ids=['listening-api', 'closed-api']) def test_live_cli_complete_source_uses_http_listener(tmp_path, monkeypatch, listening): diff --git a/tests/test_capability_acceptance.py b/tests/test_capability_acceptance.py index c8567b028..6c9d78ab7 100644 --- a/tests/test_capability_acceptance.py +++ b/tests/test_capability_acceptance.py @@ -38,6 +38,9 @@ from generation_helpers import command as generation_command, settled +pytestmark = pytest.mark.cpu + + def command_for(project, config): _, project_id, _ = project target, spec = configure(project, config) diff --git a/tests/test_capability_contract.py b/tests/test_capability_contract.py index 19cc01b21..f1ea00907 100644 --- a/tests/test_capability_contract.py +++ b/tests/test_capability_contract.py @@ -48,6 +48,9 @@ classified_capabilities, declarations, required_roles_for, resolve, role_verdict, route_path) + +pytestmark = pytest.mark.cpu + FIXTURES = Path(__file__).parent / 'fixtures' / 'omni-capabilities' CONTRACT_DOC = Path(__file__).resolve().parents[1] / 'docs' / 'architecture' / 'capability-contract.md' CONTRACT_RULE = FIXTURES / 'contract-rule.txt' diff --git a/tests/test_capability_contract_integration.py b/tests/test_capability_contract_integration.py index 408ce5a6e..52ede7534 100644 --- a/tests/test_capability_contract_integration.py +++ b/tests/test_capability_contract_integration.py @@ -10,6 +10,9 @@ from test_model_availability import document, service +pytestmark = pytest.mark.cpu + + def config(kind, protocol='openai'): return {'kind': kind, 'protocol': protocol, 'url': 'http://models.test/proxy/v1', 'modelId': 'demo'} diff --git a/tests/test_capability_freshness.py b/tests/test_capability_freshness.py index 7d6cc78e4..47b8e71d4 100644 --- a/tests/test_capability_freshness.py +++ b/tests/test_capability_freshness.py @@ -8,6 +8,9 @@ from test_model_availability import NOW, private, service +pytestmark = pytest.mark.cpu + + def observed(age): return datetime.fromtimestamp(NOW - age, timezone.utc).isoformat() diff --git a/tests/test_capability_identity.py b/tests/test_capability_identity.py index 00283d45b..ea4939d88 100644 --- a/tests/test_capability_identity.py +++ b/tests/test_capability_identity.py @@ -17,6 +17,9 @@ from test_model_availability import document +pytestmark = pytest.mark.cpu + + def saved_config(tmp_path): configs = ModelConfigs(tmp_path) saved = configs.save('agent', 'http://models.test/v1', 'demo', 'synthetic-key-one', diff --git a/tests/test_capability_input_projection.py b/tests/test_capability_input_projection.py index 6043ebc10..fe9e99652 100644 --- a/tests/test_capability_input_projection.py +++ b/tests/test_capability_input_projection.py @@ -11,6 +11,9 @@ from test_model_availability import document, private, service +pytestmark = pytest.mark.cpu + + @pytest.mark.parametrize('rule,options,value', [ ('title', ['English'], 'english'), ('title', ['english'], 'ENGLISH'), ('lower', ['af_heart'], 'AF_HEART'), ('lower', ['default'], 'DEFAULT'), diff --git a/tests/test_ci_hardware.py b/tests/test_ci_hardware.py new file mode 100644 index 000000000..c2c382c31 --- /dev/null +++ b/tests/test_ci_hardware.py @@ -0,0 +1,62 @@ +"""Exercise the actual collection hook before pytest's mark deselection.""" +import json +import os +from pathlib import Path +import subprocess +import sys + +import pytest + +pytestmark = [pytest.mark.cpu, pytest.mark.ready] +ROOT = Path(__file__).resolve().parents[1] + + +def run_sample(tmp_path, source, *options): + path = tmp_path / 'test_sample.py' + path.write_text('import pytest\n' + source, encoding='utf-8') + report = tmp_path / 'profile.json' + result = subprocess.run([ + sys.executable, '-m', 'pytest', str(path), '--noconftest', + '-p', 'ci_hardware', '-p', 'ci_profile', '-c', str(ROOT / 'pyproject.toml'), + '-q', '--strict-markers', '--ci-profile=' + str(report), *options, + ], env={**os.environ, 'PYTHONPATH': str(ROOT / 'tests'), + 'PYTEST_DISABLE_PLUGIN_AUTOLOAD': '1', 'PYTHONIOENCODING': 'utf-8', 'PYTEST_ADDOPTS': ''}, + capture_output=True, text=True, encoding='utf-8', timeout=30) + return result, report + + +def test_cpu_default_precedes_deselection_and_preserves_layers(tmp_path): + result, report = run_sample(tmp_path, ''' +@pytest.mark.ready +def test_default(): pass +@pytest.mark.cpu +@pytest.mark.merge +def test_explicit(): pass +@pytest.mark.cuda +def test_accelerator(): assert False +''', '-m', 'cpu') + assert result.returncode == 0, result.stdout + result.stderr + data = json.loads(report.read_text(encoding='utf-8')) + assert data['collected_count'] == 2 and data['deselected_count'] == 1 + assert data['hardware'] == {'cpu': 2} + assert sorted(t['hardware_migration_default'] for t in data['tests']) == [False, True] + assert data['layers'] == {'ready': 1, 'merge': 1} + + +@pytest.mark.parametrize('marks', [ + '@pytest.mark.cpu\n@pytest.mark.cuda', + '@pytest.mark.gpu\n@pytest.mark.rocm', + 'pytestmark = pytest.mark.cpu\n@pytest.mark.npu', +]) +def test_conflicts_fail_even_if_cpu_filter_would_hide_them(tmp_path, marks): + result, _ = run_sample(tmp_path, marks + '\ndef test_conflict(): pass\n', '-m', 'cpu') + assert result.returncode == 4, result.stdout + result.stderr + assert 'Conflicting hardware platforms' in result.stderr + + +@pytest.mark.parametrize('platform', ['gpu', 'cuda', 'rocm', 'xpu', 'npu']) +def test_reserved_platform_is_not_mislabeled_cpu(tmp_path, platform): + result, report = run_sample(tmp_path, + '@pytest.mark.' + platform + '\ndef test_reserved(): pass\n') + assert result.returncode == 0, result.stdout + result.stderr + assert json.loads(report.read_text(encoding='utf-8'))['hardware'] == {platform: 1} diff --git a/tests/test_ci_layers.py b/tests/test_ci_layers.py index 7ebff1b7b..ce63dd1b0 100644 --- a/tests/test_ci_layers.py +++ b/tests/test_ci_layers.py @@ -6,7 +6,7 @@ import pytest -pytestmark = pytest.mark.ready +pytestmark = [pytest.mark.cpu, pytest.mark.ready] spec = importlib.util.spec_from_file_location('layer_audit', Path(__file__).resolve().parents[1] / 'scripts/ci/check_test_layers.py') audit_module = importlib.util.module_from_spec(spec) @@ -105,3 +105,21 @@ def test_skipped_representative_is_not_execution_evidence(evidence): assert audit_module.audit(*evidence)['representative_outcomes'] == {'skipped': 1} with pytest.raises(ValueError, match='execution'): audit_module.audit(*evidence, require_executed=True) + + +def test_cpu_inventory_requires_matching_hardware_evidence(evidence): + profile = evidence[0] + profile['metadata']['selection'] = 'cpu' + for case in profile['tests']: + case['hardware'] = ['cpu'] + assert audit_module.audit(*evidence)['tests'] == 2 + profile['tests'][1]['hardware'] = ['cuda'] + with pytest.raises(ValueError, match='non-CPU hardware'): + audit_module.audit(*evidence) + + +def test_cpu_filter_cannot_hide_accelerator_cases_from_full_audit(evidence): + evidence[0]['metadata']['selection'] = 'cpu' + evidence[0]['deselected_count'] = 1 + with pytest.raises(ValueError, match='unfiltered'): + audit_module.audit(*evidence) diff --git a/tests/test_ci_profile.py b/tests/test_ci_profile.py index 282b4b5de..eef207e7d 100644 --- a/tests/test_ci_profile.py +++ b/tests/test_ci_profile.py @@ -8,7 +8,7 @@ import pytest -pytestmark = pytest.mark.ready +pytestmark = [pytest.mark.cpu, pytest.mark.ready] ROOT = Path(__file__).resolve().parents[1] SAMPLE = '''import pytest @pytest.mark.ready diff --git a/tests/test_ci_scope.py b/tests/test_ci_scope.py index 0c51c0052..3f4ed0acd 100644 --- a/tests/test_ci_scope.py +++ b/tests/test_ci_scope.py @@ -10,7 +10,7 @@ import yaml -pytestmark = pytest.mark.ready +pytestmark = [pytest.mark.cpu, pytest.mark.ready] ROOT = Path(__file__).resolve().parents[1] SCRIPT = ROOT / 'scripts/ci/select_checks.py' spec = importlib.util.spec_from_file_location('check_scope', SCRIPT) diff --git a/tests/test_ci_security.py b/tests/test_ci_security.py index 2c32fb776..a31d1b0ac 100644 --- a/tests/test_ci_security.py +++ b/tests/test_ci_security.py @@ -10,7 +10,7 @@ import yaml -pytestmark = pytest.mark.ready +pytestmark = [pytest.mark.cpu, pytest.mark.ready] ROOT = Path(__file__).resolve().parents[1] diff --git a/tests/test_ci_summary.py b/tests/test_ci_summary.py index 318fa8acb..501a1b6b1 100644 --- a/tests/test_ci_summary.py +++ b/tests/test_ci_summary.py @@ -8,7 +8,7 @@ import pytest -pytestmark = pytest.mark.ready +pytestmark = [pytest.mark.cpu, pytest.mark.ready] SCRIPT = Path(__file__).resolve().parents[1] / 'scripts/ci/summarize_checks.py' diff --git a/tests/test_cli.py b/tests/test_cli.py index 3c6689eb2..16d4b4c0e 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -22,6 +22,9 @@ from opendirector_api.main import create_app +pytestmark = pytest.mark.cpu + + def test_cli_preserves_the_font_error_code_and_english_diagnostic(tmp_path, monkeypatch): api = TestClient(create_app(LocalProjects(tmp_path))) original_client = httpx.Client diff --git a/tests/test_cli_discovery.py b/tests/test_cli_discovery.py index d99d8d045..7eea73e5e 100644 --- a/tests/test_cli_discovery.py +++ b/tests/test_cli_discovery.py @@ -5,7 +5,7 @@ from opendirector.agent import cli_discovery as discovery from opendirector.agent import deepseek, jiuwenswarm, native, runtime -pytestmark = pytest.mark.ready +pytestmark = [pytest.mark.cpu, pytest.mark.ready] def test_path_has_priority(monkeypatch): diff --git a/tests/test_continuation_availability.py b/tests/test_continuation_availability.py index 220fdc1e1..28b966c94 100644 --- a/tests/test_continuation_availability.py +++ b/tests/test_continuation_availability.py @@ -5,6 +5,9 @@ import pytest +pytestmark = pytest.mark.cpu + + @pytest.mark.parametrize('state,expected,reason', [ ('open', 'unknown', 'profile_not_declared'), ('closed', 'unavailable', 'route_disabled'), diff --git a/tests/test_creation_api.py b/tests/test_creation_api.py index ebb732009..3af318a79 100644 --- a/tests/test_creation_api.py +++ b/tests/test_creation_api.py @@ -11,6 +11,9 @@ from opendirector_api.main import create_app +pytestmark = pytest.mark.cpu + + @pytest.fixture def api(tmp_path): local = LocalProjects(tmp_path) diff --git a/tests/test_creation_artifacts.py b/tests/test_creation_artifacts.py index eed896ba0..b9a70848d 100644 --- a/tests/test_creation_artifacts.py +++ b/tests/test_creation_artifacts.py @@ -22,6 +22,9 @@ from opendirector_api.main import create_app +pytestmark = pytest.mark.cpu + + @pytest.fixture def publication(tmp_path): projects = CreationProjects(LocalProjects(tmp_path)) diff --git a/tests/test_creation_assembly.py b/tests/test_creation_assembly.py index b24661c9e..c87fe3a86 100644 --- a/tests/test_creation_assembly.py +++ b/tests/test_creation_assembly.py @@ -15,6 +15,9 @@ from test_creation_canvas_service import project, media, send, ver +pytestmark = pytest.mark.cpu + + def upload_source(project, tmp_path, kind, seconds=1, color='blue'): store, pid, session = project if kind == 'image': diff --git a/tests/test_creation_assets.py b/tests/test_creation_assets.py index ed52f598d..dd0f6cf40 100644 --- a/tests/test_creation_assets.py +++ b/tests/test_creation_assets.py @@ -23,6 +23,9 @@ from opendirector_api.main import create_app +pytestmark = pytest.mark.cpu + + def command(project_id, kind='project.create', **payload): return parse_command(dict(projectId=project_id, commandId=uuid4(), type=kind, payload=payload)) diff --git a/tests/test_creation_canvas_service.py b/tests/test_creation_canvas_service.py index ac7f8f6ad..99cd88e1b 100644 --- a/tests/test_creation_canvas_service.py +++ b/tests/test_creation_canvas_service.py @@ -12,6 +12,9 @@ from opendirector.infrastructure.local_projects import LocalProjects +pytestmark = pytest.mark.cpu + + @pytest.fixture def project(tmp_path): store = CreationProjects(LocalProjects(tmp_path)) diff --git a/tests/test_creation_contracts.py b/tests/test_creation_contracts.py index cd48c7854..041a98355 100644 --- a/tests/test_creation_contracts.py +++ b/tests/test_creation_contracts.py @@ -20,6 +20,9 @@ from opendirector.domain.creation.project import ViewState from opendirector.domain.input_rules import input_rules + +pytestmark = pytest.mark.cpu + ROOT = Path(__file__).resolve().parents[1] PROJECT = UUID(int=1) diff --git a/tests/test_creation_crop.py b/tests/test_creation_crop.py index c61f34d12..4335d3593 100644 --- a/tests/test_creation_crop.py +++ b/tests/test_creation_crop.py @@ -17,6 +17,9 @@ from test_creation_node_versions import versions +pytestmark = pytest.mark.cpu + + def crop_command(project, item_id, *, brightness=125): store, pid, session = project assets = CreationAssets(store) diff --git a/tests/test_creation_generation_service.py b/tests/test_creation_generation_service.py index cbad1e4ae..104988ed9 100644 --- a/tests/test_creation_generation_service.py +++ b/tests/test_creation_generation_service.py @@ -11,6 +11,9 @@ from test_creation_canvas_service import project, media, send, text_material, ver +pytestmark = pytest.mark.cpu + + @pytest.fixture def anyio_backend(): return 'asyncio' diff --git a/tests/test_creation_history_service.py b/tests/test_creation_history_service.py index daa2bf031..01bd16c60 100644 --- a/tests/test_creation_history_service.py +++ b/tests/test_creation_history_service.py @@ -8,6 +8,9 @@ from test_creation_canvas_service import project, media, send, text_material, ver +pytestmark = pytest.mark.cpu + + @pytest.mark.parametrize('transition', ['undo', 'redo']) @pytest.mark.parametrize('locked_owner', ['node', 'parent', 'second_owner']) @pytest.mark.parametrize('actor', ['ui', 'agent']) diff --git a/tests/test_creation_image_edits.py b/tests/test_creation_image_edits.py index 4757c1d3b..b2c440d8e 100644 --- a/tests/test_creation_image_edits.py +++ b/tests/test_creation_image_edits.py @@ -18,6 +18,9 @@ from test_creation_node_versions import versions +pytestmark = pytest.mark.cpu + + def png(color): out = BytesIO() Image.new('RGB', (64, 64), color).save(out, 'PNG') diff --git a/tests/test_creation_layers.py b/tests/test_creation_layers.py index 9f2a29408..2fd430fc4 100644 --- a/tests/test_creation_layers.py +++ b/tests/test_creation_layers.py @@ -1,4 +1,6 @@ """Attached layer persistence, protected writes and reversible associations.""" + +import pytest from io import BytesIO from uuid import uuid4 @@ -12,6 +14,9 @@ from opendirector.application.creation_canvas import asset_ref +pytestmark = pytest.mark.cpu + + def layered_image(project): store, pid, session = project out = BytesIO() diff --git a/tests/test_creation_media_publication.py b/tests/test_creation_media_publication.py index 11b8ac78e..70a4eb13e 100644 --- a/tests/test_creation_media_publication.py +++ b/tests/test_creation_media_publication.py @@ -13,6 +13,9 @@ from test_creation_tool_drafts import png +pytestmark = pytest.mark.cpu + + def prepared(project, count=2): store, pid, session = project assets = CreationToolAssets(store) diff --git a/tests/test_creation_node_versions.py b/tests/test_creation_node_versions.py index c637c5777..0e44ef4e5 100644 --- a/tests/test_creation_node_versions.py +++ b/tests/test_creation_node_versions.py @@ -13,6 +13,9 @@ from test_creation_generation_service import Provider, runtime, configure, anyio_backend +pytestmark = pytest.mark.cpu + + def versions(snapshot): return [ver(kind, obj) for (kind, _), obj in object_index(snapshot).items()] diff --git a/tests/test_creation_parameters.py b/tests/test_creation_parameters.py index bc4be6da8..0faeabfdd 100644 --- a/tests/test_creation_parameters.py +++ b/tests/test_creation_parameters.py @@ -27,6 +27,9 @@ from generation_helpers import prepared +pytestmark = pytest.mark.cpu + + def png(size=(32, 24), color='blue'): out = BytesIO() Image.new('RGB', size, color).save(out, 'PNG') diff --git a/tests/test_creation_reference_editor.py b/tests/test_creation_reference_editor.py index b09d0839e..7fc74c4bb 100644 --- a/tests/test_creation_reference_editor.py +++ b/tests/test_creation_reference_editor.py @@ -7,6 +7,9 @@ from opendirector.domain.creation.commands import parse_command +pytestmark = pytest.mark.cpu + + def setup_reference(project): store, pid, session = project source, asset = text_material(project, title='Original') diff --git a/tests/test_creation_storage.py b/tests/test_creation_storage.py index dd8535881..f0939544b 100644 --- a/tests/test_creation_storage.py +++ b/tests/test_creation_storage.py @@ -20,6 +20,9 @@ from opendirector.infrastructure.local_projects import LocalProjects, read_json +pytestmark = pytest.mark.cpu + + @pytest.fixture def unrecycled(monkeypatch): """Delete through the filesystem so tests never touch the machine recycle bin.""" diff --git a/tests/test_creation_timeline_render.py b/tests/test_creation_timeline_render.py index 68a32b6b8..f6ae2a244 100644 --- a/tests/test_creation_timeline_render.py +++ b/tests/test_creation_timeline_render.py @@ -13,6 +13,9 @@ from test_creation_canvas_service import project, send, ver +pytestmark = pytest.mark.cpu + + def clip(seconds=2, size='64x64', color='blue'): return subprocess.run(['ffmpeg', '-v', 'error', '-f', 'lavfi', '-i', f'color={color}:s={size}:r=24', '-t', str(seconds), '-threads', '1', '-c:v', 'libx264', '-pix_fmt', 'yuv420p', diff --git a/tests/test_creation_timeline_text.py b/tests/test_creation_timeline_text.py index 9b22986ac..4347898a3 100644 --- a/tests/test_creation_timeline_text.py +++ b/tests/test_creation_timeline_text.py @@ -11,6 +11,9 @@ from opendirector.infrastructure.creation_projects import CreationProjects from opendirector.infrastructure.local_projects import LocalProjects + +pytestmark = pytest.mark.cpu + FIXTURES = Path(__file__).parent / 'fixtures/timeline-text' FONT = dict(assetId=str(UUID(int=87101)), revision=1, kind='file', fingerprint='sha256:'+'a'*64) diff --git a/tests/test_creation_tool_drafts.py b/tests/test_creation_tool_drafts.py index af41b6c95..d5b878ca3 100644 --- a/tests/test_creation_tool_drafts.py +++ b/tests/test_creation_tool_drafts.py @@ -21,6 +21,9 @@ from test_creation_canvas_service import project, send, ver +pytestmark = pytest.mark.cpu + + def png(color='blue', size=(64, 48)): out = BytesIO() Image.new('RGBA', size, color).save(out, 'PNG') diff --git a/tests/test_creation_workflow.py b/tests/test_creation_workflow.py index ffc2a124d..67209794b 100644 --- a/tests/test_creation_workflow.py +++ b/tests/test_creation_workflow.py @@ -18,6 +18,9 @@ from test_creation_generation_service import anyio_backend, Provider, runtime, configure +pytestmark = pytest.mark.cpu + + async def submit(runner, project, spec_id, origin=None, policy='if_current', *, batch_id=None, additional=False): store, pid, session = project current = store.snapshot(pid) diff --git a/tests/test_cutout_capability_acceptance.py b/tests/test_cutout_capability_acceptance.py index 3605ae8c9..cfe5ea8a3 100644 --- a/tests/test_cutout_capability_acceptance.py +++ b/tests/test_cutout_capability_acceptance.py @@ -18,6 +18,9 @@ from test_tool_tasks import configure, png, project, upload +pytestmark = pytest.mark.cpu + + @pytest.mark.parametrize('mode', ['unsupported', 'closed', 'background_denied', 'allowed']) def test_cutout_checks_edit_request_and_replays_accepted_output(project, mode): store, pid, session = project diff --git a/tests/test_daily_benchmark.py b/tests/test_daily_benchmark.py index abf933e32..c30e761c0 100644 --- a/tests/test_daily_benchmark.py +++ b/tests/test_daily_benchmark.py @@ -8,6 +8,9 @@ import pytest + +pytestmark = pytest.mark.cpu + ROOT = Path(__file__).resolve().parents[1] CONFIG = ROOT / 'scripts/nightly/benchmark.json' SCRIPT = ROOT / 'scripts/nightly/daily_benchmark.py' diff --git a/tests/test_deepseek_engine.py b/tests/test_deepseek_engine.py index d4ac587e2..3bc471400 100644 --- a/tests/test_deepseek_engine.py +++ b/tests/test_deepseek_engine.py @@ -18,7 +18,7 @@ from opendirector.agent.owner_rights import native_owner_access from opendirector_api.main import create_app -pytestmark = pytest.mark.nightly +pytestmark = [pytest.mark.cpu, pytest.mark.nightly] @pytest.mark.skipif(os.getenv('DEEPSEEK_ENGINE_TEST') != '1', reason='requires installed dsh CLI') diff --git a/tests/test_deepseek_runtime.py b/tests/test_deepseek_runtime.py index 27320f9fc..ba4803b5e 100644 --- a/tests/test_deepseek_runtime.py +++ b/tests/test_deepseek_runtime.py @@ -18,6 +18,9 @@ from opendirector_api.main import create_app from opendirector.infrastructure.local_projects import LocalProjects + +pytestmark = pytest.mark.cpu + FAKE = r''' import json, os, shutil, subprocess, sys from pathlib import Path diff --git a/tests/test_desktop_host.py b/tests/test_desktop_host.py index f90f342e3..f527e1716 100644 --- a/tests/test_desktop_host.py +++ b/tests/test_desktop_host.py @@ -12,6 +12,9 @@ from opendirector.infrastructure.local_projects import LocalProjects +pytestmark = pytest.mark.cpu + + def test_desktop_auth_protects_api_and_static_without_changing_browser_mode(tmp_path): app = create_app(LocalProjects(tmp_path)) app.add_middleware(DesktopAuthentication, token='a' * 64) diff --git a/tests/test_directory_links.py b/tests/test_directory_links.py index e1893e1a4..db3ebe377 100644 --- a/tests/test_directory_links.py +++ b/tests/test_directory_links.py @@ -4,6 +4,9 @@ from opendirector.agent.directory_links import link_directory, unlink_directory +pytestmark = pytest.mark.cpu + + def test_directory_alias_roundtrip_and_dangling_cleanup(tmp_path): target = tmp_path / 'private skills' target.mkdir() diff --git a/tests/test_endpoint_closure.py b/tests/test_endpoint_closure.py index 6a19edea6..7fdf73043 100644 --- a/tests/test_endpoint_closure.py +++ b/tests/test_endpoint_closure.py @@ -18,6 +18,9 @@ from generation_helpers import settled +pytestmark = pytest.mark.cpu + + def missing_declaration(missing, **kwargs): value = document(**kwargs) if missing == 'model': diff --git a/tests/test_execution_files.py b/tests/test_execution_files.py index 19ce39b08..b1430e837 100644 --- a/tests/test_execution_files.py +++ b/tests/test_execution_files.py @@ -8,6 +8,9 @@ from opendirector.infrastructure.execution_files import execution_file +pytestmark = pytest.mark.cpu + + def test_execution_file_rejects_a_hardlink_to_an_outside_file(tmp_path): work = tmp_path / 'work' work.mkdir() diff --git a/tests/test_fasth3_capability_acceptance.py b/tests/test_fasth3_capability_acceptance.py index 23a5e927f..80117c5f6 100644 --- a/tests/test_fasth3_capability_acceptance.py +++ b/tests/test_fasth3_capability_acceptance.py @@ -20,6 +20,9 @@ from test_video_capability_acceptance import clip, video_service +pytestmark = pytest.mark.cpu + + def frame_command(project, config, *, same_asset=False, mode='first_frame'): store, pid, session = project pictures = [png(color='red'), png(color='red' if same_asset else 'blue')] diff --git a/tests/test_fasth3_inputs.py b/tests/test_fasth3_inputs.py index f6c9f5a78..bb0f50ddc 100644 --- a/tests/test_fasth3_inputs.py +++ b/tests/test_fasth3_inputs.py @@ -13,6 +13,9 @@ from opendirector.integrations.fasth3 import native_prompt, video_parameters +pytestmark = pytest.mark.cpu + + def source(kind, name, **extra): return {'id': str(uuid4()), 'name': name, 'kind': kind, 'type': kind + '/mp4', **extra} diff --git a/tests/test_ffmpeg_frame_sync.py b/tests/test_ffmpeg_frame_sync.py index 86f85765c..51cb5b857 100644 --- a/tests/test_ffmpeg_frame_sync.py +++ b/tests/test_ffmpeg_frame_sync.py @@ -12,6 +12,9 @@ from opendirector.media import processing +pytestmark = pytest.mark.cpu + + @pytest.mark.parametrize(('help_text', 'expected'), [ (b'-fps_mode[:] set framerate mode\n', '-fps_mode'), (b'-fps_mode[:stream_specifier] fps_mode set framerate mode\n-vsync sync_mode set video sync\n', '-fps_mode'), diff --git a/tests/test_generation_errors.py b/tests/test_generation_errors.py index 4fa946f9b..8398f0de7 100644 --- a/tests/test_generation_errors.py +++ b/tests/test_generation_errors.py @@ -16,6 +16,9 @@ from opendirector.integrations.volcengine import VolcengineGeneration +pytestmark = pytest.mark.cpu + + SECRET = 'private-key-never-record' SIGNED_URL = 'https://cdn.test/output?signature=secret-signature' diff --git a/tests/test_generation_recovery.py b/tests/test_generation_recovery.py index 35f08eed2..345f5dcc6 100644 --- a/tests/test_generation_recovery.py +++ b/tests/test_generation_recovery.py @@ -23,6 +23,9 @@ from opendirector_api.main import create_app +pytestmark = pytest.mark.cpu + + def png(): stream = io.BytesIO() Image.new('RGB', (16, 12)).save(stream, 'PNG') diff --git a/tests/test_heif.py b/tests/test_heif.py index e3fd8e3d1..bb3623494 100644 --- a/tests/test_heif.py +++ b/tests/test_heif.py @@ -21,6 +21,9 @@ from test_creation_assets import storage, import_asset from test_agent_artifacts import publication + +pytestmark = pytest.mark.cpu + FIXTURES = Path(__file__).parent / 'fixtures' / 'heif' diff --git a/tests/test_hidden_reference_roundtrip.py b/tests/test_hidden_reference_roundtrip.py index 03a93ba9a..f9b7c4a85 100644 --- a/tests/test_hidden_reference_roundtrip.py +++ b/tests/test_hidden_reference_roundtrip.py @@ -13,6 +13,9 @@ from opendirector.infrastructure.creation_projects import CreationProjects +pytestmark = pytest.mark.cpu + + @pytest.mark.parametrize('binding', ['follow_current', 'pinned']) @pytest.mark.parametrize('hide_group', [False, True]) def test_hidden_reference_survives_frontend_edit_save_and_reopen(project, tmp_path, binding, hide_group): diff --git a/tests/test_image_input_policy.py b/tests/test_image_input_policy.py index 67d83a2fa..f39913c19 100644 --- a/tests/test_image_input_policy.py +++ b/tests/test_image_input_policy.py @@ -9,6 +9,9 @@ from opendirector.domain.projects import ProjectError +pytestmark = pytest.mark.cpu + + def png(mode='RGB', size=(64, 64), color=128): output = BytesIO() Image.new(mode, size, color).save(output, format='PNG') diff --git a/tests/test_image_quality_test.py b/tests/test_image_quality_test.py index 7e3b91e49..3f2d7b666 100644 --- a/tests/test_image_quality_test.py +++ b/tests/test_image_quality_test.py @@ -28,6 +28,9 @@ from test_creation_canvas_service import send, ver +pytestmark = pytest.mark.cpu + + def png(): stream = BytesIO() Image.new('RGB', (32, 24), 'green').save(stream, 'PNG') diff --git a/tests/test_installation.py b/tests/test_installation.py index 26d57680c..f9df1af77 100644 --- a/tests/test_installation.py +++ b/tests/test_installation.py @@ -1,7 +1,12 @@ """Installed resources and writable project storage have distinct roots.""" + +import pytest from opendirector import installation +pytestmark = pytest.mark.cpu + + def test_wheel_defaults_to_user_workspace_not_package(monkeypatch, tmp_path): monkeypatch.delenv('OPENDIRECTOR_ROOT', raising=False) monkeypatch.setattr(installation, 'SOURCE_ROOT', None) diff --git a/tests/test_jiuwenswarm_engine.py b/tests/test_jiuwenswarm_engine.py index c2d546087..264b8f2db 100644 --- a/tests/test_jiuwenswarm_engine.py +++ b/tests/test_jiuwenswarm_engine.py @@ -13,7 +13,7 @@ from opendirector.infrastructure.local_projects import LocalProjects from opendirector_api.main import create_app -pytestmark = pytest.mark.nightly +pytestmark = [pytest.mark.cpu, pytest.mark.nightly] @pytest.mark.skipif(os.getenv('JIUWENSWARM_ENGINE_TEST') != '1', reason='requires installed JiuwenSwarm Process CLI') diff --git a/tests/test_jiuwenswarm_media.py b/tests/test_jiuwenswarm_media.py index d6c32b2a7..25ca6e1cd 100644 --- a/tests/test_jiuwenswarm_media.py +++ b/tests/test_jiuwenswarm_media.py @@ -22,10 +22,10 @@ from opendirector.infrastructure.local_projects import LocalProjects -pytestmark = [ +pytestmark = [pytest.mark.cpu, *[ pytest.mark.nightly, pytest.mark.skipif(os.getenv('JIUWENSWARM_ENGINE_TEST') != '1', reason='requires installed JiuwenSwarm and FFmpeg'), -] +]] def native_shell_command(args): return subprocess.list2cmdline(args) if os.name == 'nt' else shlex.join(args) diff --git a/tests/test_jiuwenswarm_runtime.py b/tests/test_jiuwenswarm_runtime.py index 856cf6cdb..d215f1dfc 100644 --- a/tests/test_jiuwenswarm_runtime.py +++ b/tests/test_jiuwenswarm_runtime.py @@ -18,6 +18,9 @@ from opendirector_api.main import create_app +pytestmark = pytest.mark.cpu + + FAKE = r'''import json, os, shutil, subprocess, sys, time from pathlib import Path request = json.loads(sys.stdin.readline()) diff --git a/tests/test_kling_video.py b/tests/test_kling_video.py index 203e4b7da..d18dd8fde 100644 --- a/tests/test_kling_video.py +++ b/tests/test_kling_video.py @@ -26,6 +26,9 @@ from test_creation_canvas_service import send, ver +pytestmark = pytest.mark.cpu + + @pytest.fixture def anyio_backend(): return 'asyncio' diff --git a/tests/test_launcher.py b/tests/test_launcher.py index d991b4920..1886c7a10 100644 --- a/tests/test_launcher.py +++ b/tests/test_launcher.py @@ -1,9 +1,14 @@ """A bound port must name the real remedy instead of blaming dependencies.""" + +import pytest import socket from opendirector import launcher as launcher_module +pytestmark = pytest.mark.cpu + + def launcher(): return launcher_module diff --git a/tests/test_layer_boundary.py b/tests/test_layer_boundary.py index 418df39db..0a209935a 100644 --- a/tests/test_layer_boundary.py +++ b/tests/test_layer_boundary.py @@ -1,10 +1,15 @@ """The composition root binds dispatch without an application/infrastructure import cycle.""" + +import pytest from opendirector.application.creation_commands import CreationCommands from opendirector.ports.dispatch import command_dispatcher from opendirector.ports.gateway import gateway from opendirector.wiring import InfrastructureGateway, configure_runtime +pytestmark = pytest.mark.cpu + + def test_runtime_binding_uses_application_dispatch(): ports = configure_runtime() assert isinstance(ports, InfrastructureGateway) diff --git a/tests/test_library.py b/tests/test_library.py index 74f3712c2..2ad2e37f9 100644 --- a/tests/test_library.py +++ b/tests/test_library.py @@ -20,6 +20,9 @@ from opendirector_api.main import create_app +pytestmark = pytest.mark.cpu + + def png(color='purple', size=(13, 7)): buffer = BytesIO() Image.new('RGB', size, color).save(buffer, format='PNG') @@ -232,4 +235,4 @@ def test_trash_writes_nothing_inside_projects(client, tmp_path, store): client.delete('/api/library/trash') after = {p.name: p.stat().st_mtime_ns for p in project_dir.rglob('*') if p.is_file()} - assert before == after \ No newline at end of file + assert before == after diff --git a/tests/test_local_json.py b/tests/test_local_json.py index ccfbaacef..930086437 100644 --- a/tests/test_local_json.py +++ b/tests/test_local_json.py @@ -15,6 +15,9 @@ from opendirector.infrastructure.creation_projects import CreationProjects +pytestmark = pytest.mark.cpu + + def test_atomic_json_publication_preserves_open_reader_and_publishes_after_close(tmp_path, monkeypatch): path = tmp_path / 'state.json' before, after = {'revision': 1}, {'revision': 2, 'text': '中文'} diff --git a/tests/test_localization.py b/tests/test_localization.py index 193865599..e96c4c824 100644 --- a/tests/test_localization.py +++ b/tests/test_localization.py @@ -1,3 +1,5 @@ + +import pytest from types import SimpleNamespace from opendirector_api.localization import ( @@ -7,6 +9,9 @@ ) +pytestmark = pytest.mark.cpu + + def request(language: str): return SimpleNamespace(headers={"accept-language": language}) diff --git a/tests/test_minimax_image.py b/tests/test_minimax_image.py index 7e8f24ea6..10bfae5cf 100644 --- a/tests/test_minimax_image.py +++ b/tests/test_minimax_image.py @@ -22,6 +22,9 @@ from test_creation_assets import import_asset, ref from test_creation_canvas_service import project, media, send, ver + +pytestmark = pytest.mark.cpu + URL = 'https://api.minimax.cn/v1' RESULT = 'https://93.184.215.14/output.png' MODELS = ('MiniMax-H3-Image', 'MiniMax-H3-Image-Highspeed') diff --git a/tests/test_minimax_speech.py b/tests/test_minimax_speech.py index 28d4032e4..b2b0ccc82 100644 --- a/tests/test_minimax_speech.py +++ b/tests/test_minimax_speech.py @@ -34,6 +34,9 @@ from test_moss import mp3 from test_voice_library import Configs + +pytestmark = pytest.mark.cpu + URL = 'https://api.minimax.cn/v1' RESULT = 'https://93.184.215.14/speech.mp3?signature=fixture-result-signature' SECRET = 'minimax-test-key' diff --git a/tests/test_minimax_video.py b/tests/test_minimax_video.py index 890b459ef..94a1d8694 100644 --- a/tests/test_minimax_video.py +++ b/tests/test_minimax_video.py @@ -19,6 +19,9 @@ from test_multimodal_references import media, task +pytestmark = pytest.mark.cpu + + @pytest.fixture def anyio_backend(): return 'asyncio' diff --git a/tests/test_model_availability.py b/tests/test_model_availability.py index 282b0c9cd..370739a3d 100644 --- a/tests/test_model_availability.py +++ b/tests/test_model_availability.py @@ -18,6 +18,9 @@ from opendirector.integrations.capability_probe import CapabilityProbe +pytestmark = pytest.mark.cpu + + NOW = 1794225600.0 diff --git a/tests/test_model_catalog.py b/tests/test_model_catalog.py index b28832d70..3031d19c4 100644 --- a/tests/test_model_catalog.py +++ b/tests/test_model_catalog.py @@ -12,6 +12,9 @@ from opendirector.infrastructure.model_configs import ModelConfigs +pytestmark = pytest.mark.cpu + + class Store: def __init__(self, existing=None): self.existing = existing diff --git a/tests/test_model_configs.py b/tests/test_model_configs.py index 3ab9a0beb..4289db25c 100644 --- a/tests/test_model_configs.py +++ b/tests/test_model_configs.py @@ -11,6 +11,9 @@ from opendirector_api.main import create_app +pytestmark = pytest.mark.cpu + + @pytest.fixture def api(tmp_path): store = LocalProjects(tmp_path) diff --git a/tests/test_model_gateway.py b/tests/test_model_gateway.py index 14d5131e0..777c5aa49 100644 --- a/tests/test_model_gateway.py +++ b/tests/test_model_gateway.py @@ -10,6 +10,9 @@ from opendirector.domain.projects import ProjectError +pytestmark = pytest.mark.cpu + + class Stream(httpx.AsyncByteStream): def __init__(self, chunks, failure=None, gate=None): self.chunks, self.failure, self.gate = chunks, failure, gate diff --git a/tests/test_model_http_logging.py b/tests/test_model_http_logging.py index c2d911706..9dd639fe1 100644 --- a/tests/test_model_http_logging.py +++ b/tests/test_model_http_logging.py @@ -8,6 +8,9 @@ from opendirector.integrations.generation_errors import transport_failure +pytestmark = pytest.mark.cpu + + def test_logs_each_query_submission_poll_and_cancel(caplog): caplog.set_level('DEBUG', logger='opendirector.integrations.http_settings') diff --git a/tests/test_model_reasoning_trace.py b/tests/test_model_reasoning_trace.py index 5eb23967a..ad38a10f5 100644 --- a/tests/test_model_reasoning_trace.py +++ b/tests/test_model_reasoning_trace.py @@ -1,4 +1,6 @@ """Record streamed reasoning while preserving upstream bytes.""" + +import pytest import asyncio import json @@ -7,6 +9,9 @@ from opendirector.agent.model_gateway import ModelGateway +pytestmark = pytest.mark.cpu + + def test_reasoning_trace_handles_fragmented_sse_without_changing_response(tmp_path): chunks = [ {"choices": [{"index": 0, "delta": {"reasoning_content": "先检查"}}]}, diff --git a/tests/test_moss.py b/tests/test_moss.py index 87b9a5dff..375e99606 100644 --- a/tests/test_moss.py +++ b/tests/test_moss.py @@ -33,6 +33,9 @@ from test_creation_parameters import png +pytestmark = pytest.mark.cpu + + SECRET = 'moss-private-test-key' VOICE = '5c8cd24a-dfd6-4fd8-8f47-93e9aec17328' OTHER_VOICE = 'f0827524-a19e-4e1c-859d-afc9fd17133e' diff --git a/tests/test_multimodal_references.py b/tests/test_multimodal_references.py index cac831c71..5b0b1d420 100644 --- a/tests/test_multimodal_references.py +++ b/tests/test_multimodal_references.py @@ -27,6 +27,9 @@ from opendirector.integrations.volcengine import VolcengineGeneration from opendirector_api.main import create_app + +pytestmark = pytest.mark.cpu + BASE = 'https://ark.cn-beijing.volces.com/api/plan/v3' diff --git a/tests/test_native_runtime.py b/tests/test_native_runtime.py index a85ad7aad..9d44c9479 100644 --- a/tests/test_native_runtime.py +++ b/tests/test_native_runtime.py @@ -30,7 +30,7 @@ # Includes subprocess/gateway integration; retain the dedicated mocked-model # bundled CLI regression in Release checks independently of layer selection. -pytestmark = pytest.mark.merge +pytestmark = [pytest.mark.cpu, pytest.mark.merge] FAKE = '''import json, os, subprocess, sys from pathlib import Path diff --git a/tests/test_native_sessions.py b/tests/test_native_sessions.py index 824cc4f94..de17cc96d 100644 --- a/tests/test_native_sessions.py +++ b/tests/test_native_sessions.py @@ -8,6 +8,9 @@ from process_helpers import directory_link +pytestmark = pytest.mark.cpu + + @pytest.mark.parametrize('location', ['valid', 'outside', 'invalid_turn', 'missing', 'alias', 'absent']) def test_native_session_directory_requires_owned_turn_identity(tmp_path, location): run = RunContext(runtime='opencode', project_id=uuid4(), turn_id=uuid4(), session=str(uuid4()), diff --git a/tests/test_nightly_perf_artifact.py b/tests/test_nightly_perf_artifact.py index 3ad68680b..440bff1fa 100644 --- a/tests/test_nightly_perf_artifact.py +++ b/tests/test_nightly_perf_artifact.py @@ -14,6 +14,9 @@ import pytest import yaml + +pytestmark = pytest.mark.cpu + ROOT = Path(__file__).resolve().parents[1] WORKFLOW = ROOT / '.github/workflows/nightly.yml' WORKSPACE = '/home/runner/work/OpenDirector/OpenDirector' diff --git a/tests/test_omni_exported_video_capabilities.py b/tests/test_omni_exported_video_capabilities.py index 1bd869661..e2e626f85 100644 --- a/tests/test_omni_exported_video_capabilities.py +++ b/tests/test_omni_exported_video_capabilities.py @@ -11,6 +11,9 @@ from opendirector.integrations.capability_probe import CapabilityProbe +pytestmark = pytest.mark.cpu + + @pytest.mark.parametrize('name,capability,status,reason', [ ('wan-i2v', 'video.first_frame', 'available', 'supported'), ('wan-vace', 'video.first_frame', 'unavailable', 'input_unsupported'), diff --git a/tests/test_openai_images.py b/tests/test_openai_images.py index 5e2695920..996ef8870 100644 --- a/tests/test_openai_images.py +++ b/tests/test_openai_images.py @@ -24,6 +24,9 @@ from opendirector.integrations.model_adapters import OpenAIImages, adapter_for from opendirector.integrations.providers import GenerationProviders + +pytestmark = pytest.mark.cpu + GPT_IMAGE = {'kind': 'image', 'url': 'https://api.openai.com/v1', 'modelId': 'gpt-image-1', 'protocol': 'openai'} KEY = 'sk-test-never-recorded' diff --git a/tests/test_owner_rights.py b/tests/test_owner_rights.py index 235d86006..7a2ebf85f 100644 --- a/tests/test_owner_rights.py +++ b/tests/test_owner_rights.py @@ -9,6 +9,9 @@ from process_helpers import directory_link +pytestmark = pytest.mark.cpu + + USER = bytes.fromhex('010100000000000515000000') WORLD = bytes.fromhex('010100000000000100000000') diff --git a/tests/test_owner_rights_journal.py b/tests/test_owner_rights_journal.py index 6cd09b814..95b528c55 100644 --- a/tests/test_owner_rights_journal.py +++ b/tests/test_owner_rights_journal.py @@ -9,6 +9,9 @@ from opendirector.agent import owner_rights as rights +pytestmark = pytest.mark.cpu + + def failure(code): error = OSError('controlled native failure') error.winerror = code diff --git a/tests/test_owner_rights_lifecycle.py b/tests/test_owner_rights_lifecycle.py index 2e61a188c..cbd804e6a 100644 --- a/tests/test_owner_rights_lifecycle.py +++ b/tests/test_owner_rights_lifecycle.py @@ -17,7 +17,7 @@ from opendirector.agent import owner_rights as rights -pytestmark = pytest.mark.skipif(os.name != 'nt', reason='requires native Windows ACL and oplock APIs') +pytestmark = [pytest.mark.cpu, pytest.mark.skipif(os.name != 'nt', reason='requires native Windows ACL and oplock APIs')] WORLD = bytes.fromhex('010100000000000100000000') diff --git a/tests/test_owner_rights_resume.py b/tests/test_owner_rights_resume.py index 1286c04f1..5e4b2efd8 100644 --- a/tests/test_owner_rights_resume.py +++ b/tests/test_owner_rights_resume.py @@ -11,7 +11,7 @@ from test_owner_rights_lifecycle import security from process_helpers import directory_link -pytestmark = pytest.mark.skipif(os.name != 'nt', reason='requires native Windows ACL and file identity APIs') +pytestmark = [pytest.mark.cpu, pytest.mark.skipif(os.name != 'nt', reason='requires native Windows ACL and file identity APIs')] def initialized_work(tmp_path): diff --git a/tests/test_posix_execution_files.py b/tests/test_posix_execution_files.py index 24d6b8bde..7d6fe16c1 100644 --- a/tests/test_posix_execution_files.py +++ b/tests/test_posix_execution_files.py @@ -14,6 +14,9 @@ from opendirector.infrastructure import execution_files as files +pytestmark = pytest.mark.cpu + + @pytest.fixture def posix_files(monkeypatch): actual = os diff --git a/tests/test_process_helpers.py b/tests/test_process_helpers.py index 9469500c5..cfd13e00e 100644 --- a/tests/test_process_helpers.py +++ b/tests/test_process_helpers.py @@ -8,6 +8,9 @@ from process_helpers import project_heartbeat +pytestmark = pytest.mark.cpu + + def test_native_directory_uses_same_owner_and_is_idempotent(tmp_path): before = tmp_path.stat() report = native_user_directory(tmp_path) diff --git a/tests/test_public_target.py b/tests/test_public_target.py index 8627b5f0e..171f0b2f8 100644 --- a/tests/test_public_target.py +++ b/tests/test_public_target.py @@ -13,6 +13,9 @@ from opendirector.integrations.volcengine import _public_result_url +pytestmark = pytest.mark.cpu + + @pytest.fixture def answers(monkeypatch): values, calls = ['93.184.216.34'], [] diff --git a/tests/test_query_guidance.py b/tests/test_query_guidance.py index 08623e3f8..a7644452a 100644 --- a/tests/test_query_guidance.py +++ b/tests/test_query_guidance.py @@ -8,6 +8,9 @@ from opendirector.domain.creation.commands import Query +pytestmark = pytest.mark.cpu + + def guidance(arguments): try: TypeAdapter(Query).validate_python({'projectId': uuid4(), 'queryId': uuid4(), **arguments}) diff --git a/tests/test_rename.py b/tests/test_rename.py index 8f873069e..14d3f4a97 100644 --- a/tests/test_rename.py +++ b/tests/test_rename.py @@ -3,6 +3,9 @@ from opendirector.infrastructure.rename import rename_path +pytestmark = pytest.mark.cpu + + def test_native_rename_never_replaces_even_an_empty_destination(tmp_path): source, target = tmp_path / "source", tmp_path / "target" source.mkdir() diff --git a/tests/test_request_capability_acceptance.py b/tests/test_request_capability_acceptance.py index 8443c245f..7518378c9 100644 --- a/tests/test_request_capability_acceptance.py +++ b/tests/test_request_capability_acceptance.py @@ -25,6 +25,9 @@ from test_voice_library import wav +pytestmark = pytest.mark.cpu + + def image_runtime(project, maximum, model='served-image-alias', *, declared_model=None, editing=True, sampling_maximum=None, observation_age=0, pause_age=None, support='supported', minimum=None, quality_enum=None): store, _, _ = project diff --git a/tests/test_result_download_security.py b/tests/test_result_download_security.py index d3cede853..de39545b5 100644 --- a/tests/test_result_download_security.py +++ b/tests/test_result_download_security.py @@ -14,6 +14,9 @@ from test_openai_images import CONFIG, png +pytestmark = pytest.mark.cpu + + @pytest.fixture def resolve(monkeypatch): calls = [] diff --git a/tests/test_retired_entry.py b/tests/test_retired_entry.py index 26c477fec..4fd3a2139 100644 --- a/tests/test_retired_entry.py +++ b/tests/test_retired_entry.py @@ -1,4 +1,6 @@ """Retired endpoints and startup cannot read, execute or repair historical data.""" + +import pytest import json from uuid import uuid4 @@ -10,6 +12,9 @@ from opendirector_api.main import create_app +pytestmark = pytest.mark.cpu + + def files(root): return {str(p.relative_to(root)): p.read_bytes() for p in root.rglob('*') if p.is_file()} diff --git a/tests/test_rule_facts.py b/tests/test_rule_facts.py index a60f787e0..b6b9326c4 100644 --- a/tests/test_rule_facts.py +++ b/tests/test_rule_facts.py @@ -14,6 +14,9 @@ ) +pytestmark = pytest.mark.cpu + + def test_timeline_contract_limits_are_published_as_shared_facts(): from opendirector.domain.creation.editors import TimelineData, TimelineTextOverlay facts = facts_payload() diff --git a/tests/test_runtime_catalog.py b/tests/test_runtime_catalog.py index e7e0be9e9..e5034e00c 100644 --- a/tests/test_runtime_catalog.py +++ b/tests/test_runtime_catalog.py @@ -9,6 +9,9 @@ from opendirector.domain.projects import ProjectError +pytestmark = pytest.mark.cpu + + @pytest.mark.parametrize('engine', ['codex', 'claude']) def test_native_model_catalog(tmp_path, monkeypatch, engine): script = tmp_path / 'cli' diff --git a/tests/test_runtime_readiness.py b/tests/test_runtime_readiness.py index 4377cd77a..3436086ff 100644 --- a/tests/test_runtime_readiness.py +++ b/tests/test_runtime_readiness.py @@ -9,6 +9,9 @@ from process_helpers import python_cli +pytestmark = pytest.mark.cpu + + @pytest.mark.parametrize(('engine', 'output', 'exit_code', 'expected'), [ ('codex', '', 0, 'ready'), ('codex', '', 1, 'needs_login'), diff --git a/tests/test_self_hosted.py b/tests/test_self_hosted.py index 2e69a56ab..ee0e983ba 100644 --- a/tests/test_self_hosted.py +++ b/tests/test_self_hosted.py @@ -20,6 +20,9 @@ from opendirector_api.main import create_app +pytestmark = pytest.mark.cpu + + def test_self_hosted_models_support_optional_auth_all_four_kinds(tmp_path): store=LocalProjects(tmp_path) headers={'X-OpenDirector-Request':'1','X-OpenDirector-Session':str(uuid4())} diff --git a/tests/test_self_hosted_proxy.py b/tests/test_self_hosted_proxy.py index d5974d0c1..99f567206 100644 --- a/tests/test_self_hosted_proxy.py +++ b/tests/test_self_hosted_proxy.py @@ -12,6 +12,9 @@ from opendirector.integrations.providers import GenerationProviders +pytestmark = pytest.mark.cpu + + @pytest.mark.parametrize('base, equivalent', [ ('http://8.92.9.154:8094/v1', 'http://8.92.9.154:8094/videos/id/content'), ('http://192.168.1.20:8093/v1', 'http://192.168.1.20:8093/videos/id/content'), diff --git a/tests/test_self_hosted_queue.py b/tests/test_self_hosted_queue.py index 71d7c0b2b..1f360300e 100644 --- a/tests/test_self_hosted_queue.py +++ b/tests/test_self_hosted_queue.py @@ -16,6 +16,9 @@ import httpx +pytestmark = pytest.mark.cpu + + @pytest.fixture def context(tmp_path): store, pid, session = new_project(tmp_path, '自部署排队') diff --git a/tests/test_skill_snapshot.py b/tests/test_skill_snapshot.py index 3d3a70604..84fa66ef3 100644 --- a/tests/test_skill_snapshot.py +++ b/tests/test_skill_snapshot.py @@ -9,6 +9,9 @@ from process_helpers import directory_link +pytestmark = pytest.mark.cpu + + @pytest.mark.parametrize('component', ['.agents', '.agents/skills']) def test_reused_snapshot_rejects_reparse_directories_before_removal(tmp_path, monkeypatch, component): work = tmp_path / 'work' diff --git a/tests/test_subject_library.py b/tests/test_subject_library.py index 042ffc569..c98b4581d 100644 --- a/tests/test_subject_library.py +++ b/tests/test_subject_library.py @@ -1,4 +1,6 @@ """Subject library preparation, owned copies and atomic import validation.""" + +import pytest from copy import deepcopy from uuid import uuid4 @@ -8,6 +10,9 @@ from opendirector.infrastructure.creation_uploads import CreationUploads +pytestmark = pytest.mark.cpu + + def test_subject_slot_validation_uses_actual_media_and_fifteen_second_limit(tmp_path): import wave import pytest diff --git a/tests/test_timeline_fonts.py b/tests/test_timeline_fonts.py index 7619796e9..da36ff793 100644 --- a/tests/test_timeline_fonts.py +++ b/tests/test_timeline_fonts.py @@ -96,6 +96,9 @@ def test_cmap_coverage_uses_content_identity_and_rejects_missing_characters(tmp_ from uuid import uuid4 +pytestmark = pytest.mark.cpu + + def timeline_document(project, tmp_path, *, font_bytes=None): store, pid, session = project path = tiny_font(tmp_path / 'fixture.ttf', characters='AB中') diff --git a/tests/test_timeline_packages.py b/tests/test_timeline_packages.py index ee3d203d5..ba09c4e73 100644 --- a/tests/test_timeline_packages.py +++ b/tests/test_timeline_packages.py @@ -11,6 +11,9 @@ from test_creation_assets import import_asset +pytestmark = pytest.mark.cpu + + def service(store): from opendirector.application.creation_timeline_packages import CreationTimelinePackages return CreationTimelinePackages(store) diff --git a/tests/test_timeline_source_connections.py b/tests/test_timeline_source_connections.py index 6a958ce77..d36d8dd9a 100644 --- a/tests/test_timeline_source_connections.py +++ b/tests/test_timeline_source_connections.py @@ -1,4 +1,6 @@ """Agent timeline creates retain unique canvas-node provenance (issue #117).""" + +import pytest from uuid import uuid4 from opendirector.application.creation_canvas import asset_ref @@ -8,6 +10,9 @@ from test_creation_canvas_service import project, send, ver +pytestmark = pytest.mark.cpu + + def _clip(asset, clip_id, *, start=None): clip = dict(id=clip_id, resource=dict(asset=asset_ref(asset), title=asset.name), inPoint=0, outPoint=asset.metadata.durationSeconds or 5) diff --git a/tests/test_tool_lifecycle.py b/tests/test_tool_lifecycle.py index 2c9aa3c0c..c2870666b 100644 --- a/tests/test_tool_lifecycle.py +++ b/tests/test_tool_lifecycle.py @@ -18,6 +18,9 @@ from test_tool_tasks import project, configure, upload, png, H3 +pytestmark = pytest.mark.cpu + + async def until(predicate): async with asyncio.timeout(5): while not predicate(): diff --git a/tests/test_tool_model_errors.py b/tests/test_tool_model_errors.py index 8f4273c1e..33c2de8cb 100644 --- a/tests/test_tool_model_errors.py +++ b/tests/test_tool_model_errors.py @@ -9,6 +9,9 @@ from test_tool_tasks import project, png, upload +pytestmark = pytest.mark.cpu + + @pytest.mark.parametrize('language', ['zh-CN', 'en-US']) @pytest.mark.parametrize('operation,capability,chinese,english', [ ('resize', 'image.edit', '图生图/图片编辑', 'image editing'), diff --git a/tests/test_tool_native_mask.py b/tests/test_tool_native_mask.py index e97675373..7183faaeb 100644 --- a/tests/test_tool_native_mask.py +++ b/tests/test_tool_native_mask.py @@ -27,6 +27,9 @@ from test_model_availability import document +pytestmark = pytest.mark.cpu + + MODEL = ('image', 'http://image.test/v1', 'test-native-edit') diff --git a/tests/test_tool_optional_image.py b/tests/test_tool_optional_image.py index 62c9f8682..2091a6576 100644 --- a/tests/test_tool_optional_image.py +++ b/tests/test_tool_optional_image.py @@ -15,6 +15,9 @@ from test_tool_tasks import project, configure, upload, png, SAM3, segmentation_server, output_rgba +pytestmark = pytest.mark.cpu + + @pytest.mark.parametrize('state', ['paused', 'unsupported', 'added', 'changed', 'legacy']) def test_layer_background_completion_never_selects_a_later_model_for_new_work(project, state): store, pid, session = project diff --git a/tests/test_tool_task_history.py b/tests/test_tool_task_history.py index 2e97cae7e..0e4753304 100644 --- a/tests/test_tool_task_history.py +++ b/tests/test_tool_task_history.py @@ -17,6 +17,9 @@ from opendirector_api.main import create_app +pytestmark = pytest.mark.cpu + + def png(): out = BytesIO() Image.new('RGB', (64, 48), 'blue').save(out, 'PNG') diff --git a/tests/test_tool_tasks.py b/tests/test_tool_tasks.py index d2908feae..e413b6391 100644 --- a/tests/test_tool_tasks.py +++ b/tests/test_tool_tasks.py @@ -18,6 +18,9 @@ from opendirector.infrastructure.model_configs import ModelConfigs from opendirector.integrations.model_adapters import OpenAIImages, adapter_for, capabilities_of + +pytestmark = pytest.mark.cpu + ZIMAGE = ('image', 'http://gpu:8210/v1', 'Tongyi-MAI/Z-Image-Turbo') H3 = ('video', 'http://gpu:8010/v1', 'MiniMaxAI/MiniMax-H3') TTS = ('audio', 'http://gpu:8220/v1', 'Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice') diff --git a/tests/test_video_capabilities.py b/tests/test_video_capabilities.py index c4504ad56..d3ae8a72e 100644 --- a/tests/test_video_capabilities.py +++ b/tests/test_video_capabilities.py @@ -19,6 +19,9 @@ from opendirector_api.main import create_app +pytestmark = pytest.mark.cpu + + CAPS = {'outputs': [ {'resolution': '540P', 'durations': [3, 5], 'width': 960, 'height': 540}, {'resolution': '720P', 'durations': [5, 7], 'width': 1280, 'height': 720}], diff --git a/tests/test_video_capability_acceptance.py b/tests/test_video_capability_acceptance.py index 997be101b..35fd8d00d 100644 --- a/tests/test_video_capability_acceptance.py +++ b/tests/test_video_capability_acceptance.py @@ -24,6 +24,9 @@ from test_creation_canvas_service import project as generation_project +pytestmark = pytest.mark.cpu + + @pytest.fixture(scope='module') def clip(): return sound_mp4(5) diff --git a/tests/test_video_request_projection.py b/tests/test_video_request_projection.py index b58cd0e23..c3b5a5508 100644 --- a/tests/test_video_request_projection.py +++ b/tests/test_video_request_projection.py @@ -9,6 +9,9 @@ from test_model_availability import private, service +pytestmark = pytest.mark.cpu + + def reference(kind, role='reference', transmission='content'): return SimpleNamespace(asset=SimpleNamespace(kind=kind), role=role, transmission=transmission, metadata=SimpleNamespace(width=1344, height=768)) diff --git a/tests/test_video_resolution.py b/tests/test_video_resolution.py index 1498b6f2e..cf0b99668 100644 --- a/tests/test_video_resolution.py +++ b/tests/test_video_resolution.py @@ -17,6 +17,9 @@ from opendirector.integrations.vllm_omni import VllmOmniGeneration +pytestmark = pytest.mark.cpu + + @pytest.mark.parametrize('resolution, ratio, expected', [ ('480P', '16:9', '832x480'), ('480P', '9:16', '480x832'), ('768P', '16:9', '1344x768'), ('768P', '9:16', '768x1344'), diff --git a/tests/test_video_role_capabilities.py b/tests/test_video_role_capabilities.py index b382a352b..2a887af0f 100644 --- a/tests/test_video_role_capabilities.py +++ b/tests/test_video_role_capabilities.py @@ -6,6 +6,9 @@ from test_video_request_projection import reference, spec, video_config +pytestmark = pytest.mark.cpu + + def configure_declaration(service, profile='video_to_video', *, inputs=None, support='supported'): configs, saved, state, availability = service config = video_config(configs, saved) diff --git a/tests/test_vllm_omni_h3.py b/tests/test_vllm_omni_h3.py index 233393d05..cf9997800 100644 --- a/tests/test_vllm_omni_h3.py +++ b/tests/test_vllm_omni_h3.py @@ -28,6 +28,9 @@ from test_model_availability import document from opendirector_api.main import create_app + +pytestmark = pytest.mark.cpu + H3 = {'protocol': 'vllm_omni', 'kind': 'video', 'url': 'http://gpu-box:8000/v1', 'modelId': 'MiniMaxAI/MiniMax-H3', 'apiKey': 'token'} diff --git a/tests/test_vllm_omni_image.py b/tests/test_vllm_omni_image.py index 677e31ce5..f967806fe 100644 --- a/tests/test_vllm_omni_image.py +++ b/tests/test_vllm_omni_image.py @@ -20,6 +20,9 @@ from opendirector.integrations import vllm_omni_image from opendirector.integrations.providers import GenerationProviders + +pytestmark = pytest.mark.cpu + ZIMAGE = {'kind': 'image', 'url': 'http://gpu-box:8200/v1', 'modelId': 'Tongyi-MAI/Z-Image-Turbo', 'apiKey': 'token'} diff --git a/tests/test_voice_library.py b/tests/test_voice_library.py index 050e139e2..0d58e116e 100644 --- a/tests/test_voice_library.py +++ b/tests/test_voice_library.py @@ -11,6 +11,9 @@ from opendirector.domain.projects import ProjectError +pytestmark = pytest.mark.cpu + + def config(model='MOSS-TTS-Nano', **patch): return dict(id=str(uuid4()), kind='audio', url='http://voice.test/v1', modelId=model, protocol='openai', connectionType='self_hosted', authMode='bearer', apiKey='private-key', **patch) diff --git a/tests/test_windows_powershell.py b/tests/test_windows_powershell.py index 2a6d15f10..42d126e44 100644 --- a/tests/test_windows_powershell.py +++ b/tests/test_windows_powershell.py @@ -13,6 +13,9 @@ from opendirector.agent import windows_powershell +pytestmark = pytest.mark.cpu + + @pytest.mark.parametrize(('source', 'bom'), [ ('stdin', b''), ('stdin', codecs.BOM_UTF8), diff --git a/tests/test_zhipu.py b/tests/test_zhipu.py index e9d7b772b..315c5b6d6 100644 --- a/tests/test_zhipu.py +++ b/tests/test_zhipu.py @@ -22,6 +22,9 @@ from test_creation_generation_service import anyio_backend # noqa: F401 +pytestmark = pytest.mark.cpu + + CHAT = {"modelId": "glm-5.3", "url": "https://open.bigmodel.cn/api/paas/v4"}