Coverage for tests/test_config.py: 100%
43 statements
« prev ^ index » next coverage.py v7.11.3, created at 2025-12-01 19:40 +0000
« prev ^ index » next coverage.py v7.11.3, created at 2025-12-01 19:40 +0000
1import unittest
2from contextlib import closing
4from wasmtime import *
7class TestConfig(unittest.TestCase):
8 def test_smoke(self):
9 config = Config()
10 config.debug_info = True
11 config.wasm_threads = True
12 config.wasm_tail_call = True
13 config.wasm_reference_types = True
14 config.wasm_simd = True
15 config.wasm_bulk_memory = True
16 config.wasm_multi_value = True
17 config.wasm_multi_memory = True
18 config.wasm_memory64 = True
19 config.wasm_exceptions = True
20 config.cranelift_debug_verifier = True
21 config.strategy = "cranelift"
22 config.strategy = "auto"
23 config.cache = True
24 config.parallel_compilation = False
25 with self.assertRaises(WasmtimeError):
26 config.cache = "./test.toml"
27 with self.assertRaises(WasmtimeError):
28 config.strategy = "nonexistent-strategy"
29 config.cranelift_opt_level = "none"
30 config.cranelift_opt_level = "speed_and_size"
31 config.cranelift_opt_level = "speed"
32 with self.assertRaises(WasmtimeError):
33 config.cranelift_opt_level = "nonexistent-level"
34 config.profiler = "none"
35 with self.assertRaises(WasmtimeError):
36 config.profiler = "nonexistent-profiler"
37 config.consume_fuel = True
38 config.wasm_relaxed_simd = True
39 config.wasm_relaxed_simd_deterministic = True
41 with closing(config) as config:
42 pass
44 config.close()
46 with self.assertRaises(ValueError):
47 Engine(config)
49 with self.assertRaises(ValueError):
50 config.cache = True