|
6 | 6 |
|
7 | 7 |
|
8 | 8 | def test_mono(example_netstandard: Path): |
9 | | - from clr_loader import get_mono |
10 | | - |
11 | | - mono = get_mono() |
12 | | - asm = mono.get_assembly(example_netstandard / "example.dll") |
13 | | - |
14 | | - run_tests(asm) |
| 9 | + run_in_subprocess(_do_test_mono, example_netstandard) |
15 | 10 |
|
16 | 11 |
|
17 | 12 | def test_mono_debug(example_netstandard: Path): |
18 | | - from clr_loader import get_mono |
19 | | - |
20 | | - mono = get_mono( |
| 13 | + run_in_subprocess( |
| 14 | + _do_test_mono, |
| 15 | + example_netstandard, |
21 | 16 | debug=True, |
22 | 17 | jit_options=[ |
23 | | - "--debugger-agent=address=0.0.0.0:5831,transport=dt_socket,server=y" |
| 18 | + "--debugger-agent=address=0.0.0.0:5831,transport=dt_socket,server=y,suspend=n" |
24 | 19 | ], |
25 | 20 | ) |
26 | | - asm = mono.get_assembly(example_netstandard / "example.dll") |
27 | | - |
28 | | - run_tests(asm) |
29 | 21 |
|
30 | 22 |
|
31 | 23 | def test_mono_signal_chaining(example_netstandard: Path): |
32 | | - from clr_loader import get_mono |
33 | | - |
34 | | - mono = get_mono(set_signal_chaining=True) |
35 | | - asm = mono.get_assembly(example_netstandard / "example.dll") |
36 | | - |
37 | | - run_tests(asm) |
| 24 | + run_in_subprocess(_do_test_mono, example_netstandard, set_signal_chaining=True) |
38 | 25 |
|
39 | 26 |
|
40 | 27 | def test_mono_trace_mask(example_netstandard: Path): |
41 | | - from clr_loader import get_mono |
42 | | - |
43 | | - mono = get_mono(trace_mask="all") |
44 | | - asm = mono.get_assembly(example_netstandard / "example.dll") |
45 | | - |
46 | | - run_tests(asm) |
| 28 | + run_in_subprocess(_do_test_mono, example_netstandard, trace_mask="all") |
47 | 29 |
|
48 | 30 |
|
49 | 31 | def test_mono_trace_level(example_netstandard: Path): |
50 | | - from clr_loader import get_mono |
| 32 | + run_in_subprocess(_do_test_mono, example_netstandard, trace_level="message") |
51 | 33 |
|
52 | | - mono = get_mono(trace_level="message") |
53 | | - asm = mono.get_assembly(example_netstandard / "example.dll") |
54 | 34 |
|
55 | | - run_tests(asm) |
| 35 | +def test_mono_set_dir(example_netstandard: Path): |
| 36 | + for candidate in ["/usr/lib", "/usr/lib64", "/usr/local/lib", "/opt/homebrew/lib"]: |
| 37 | + if (Path(candidate) / "mono").is_dir(): |
| 38 | + assembly_dir = candidate |
| 39 | + break |
| 40 | + else: |
| 41 | + pytest.skip("Could not find a valid mono assembly dir") |
56 | 42 |
|
| 43 | + run_in_subprocess( |
| 44 | + _do_test_mono, example_netstandard, assembly_dir=assembly_dir, config_dir="/etc" |
| 45 | + ) |
57 | 46 |
|
58 | | -def test_mono_set_dir(example_netstandard: Path): |
| 47 | + |
| 48 | +def _do_test_mono(example_netstandard: Path, **kwargs): |
59 | 49 | from clr_loader import get_mono |
60 | 50 |
|
61 | | - mono = get_mono(assembly_dir="/usr", config_dir="/etc") |
| 51 | + mono = get_mono(**kwargs) |
62 | 52 | asm = mono.get_assembly(example_netstandard / "example.dll") |
63 | 53 |
|
64 | 54 | run_tests(asm) |
|
0 commit comments