Spaces:
Sleeping
Sleeping
Download src/tests/runtime/test_qemu_live.py from dellweb3/VibeCoding: direct link, hf CLI and curl.
- Browser
- Download file 1.75 kB
-
https://huggingface.co/spaces/dellweb3/VibeCoding/resolve/main/src/tests/runtime/test_qemu_live.py
- Command line
-
hf download hf://spaces/dellweb3/VibeCoding/src/tests/runtime/test_qemu_live.py
-
curl -L -o test_qemu_live.py https://huggingface.co/spaces/dellweb3/VibeCoding/resolve/main/src/tests/runtime/test_qemu_live.py
1.75 kB
| """Explicitly enabled real VM execution, independent of model credentials.""" | |
| import json | |
| import os | |
| import unittest | |
| import uuid | |
| from pathlib import Path | |
| from src.adapters.sandbox.qemu import QemuSandbox | |
| from src.modules.execution.contracts import SandboxConfig | |
| from src.modules.skill.domain.models import digest | |
| from src.tests.runtime.test_container_live import SOURCE | |
| ROOT = Path(__file__).resolve().parents[3] | |
| class LiveVMTests(unittest.TestCase): | |
| def test_real_java_http_in_networkless_disposable_vm(self): | |
| manifest = json.loads((ROOT / '.local/tools/vm/manifest.json').read_text()) | |
| config = SandboxConfig(image='zkcoding-qemu@sha256:' + digest(manifest), skill_ids=['erp-java-development'], | |
| api_contract='GET /health returns status ok', | |
| tests=[{'path': '/health', 'status': 200, 'expected_json': {'status': 'ok'}}], | |
| health={'path': '/health', 'status': 200, 'expected_json': {'status': 'ok'}}) | |
| sandbox = QemuSandbox(ROOT / '.local/test-runs/qemu', config, | |
| executable=str(ROOT / '.local/tools/qemu/qemu-system-x86_64.exe'), image_root=ROOT / '.local/tools/vm') | |
| run_id = 'run-' + uuid.uuid4().hex | |
| files = {'src/main/java/demo/App.java': SOURCE} | |
| candidate = sandbox.build(run_id, {'files': files, 'source_digest': digest(files)}, lambda: False) | |
| self.assertTrue(sandbox.probe(run_id, candidate, 'test', lambda: False)['passed']) | |
| self.assertTrue(sandbox.probe(run_id, candidate, 'preview', lambda: False)['passed']) | |
| self.assertEqual(candidate['execution_mode'], 'qemu') | |
| self.assertTrue(sandbox.cleanup(run_id)) | |