|
5 | 5 |
|
6 | 6 |
|
7 | 7 | @pytest.fixture(scope="session")
|
8 |
| -def example_dll(tmpdir_factory): |
9 |
| - out = str(tmpdir_factory.mktemp("example")) |
| 8 | +def example_netstandard(tmpdir_factory): |
| 9 | + return build_example(tmpdir_factory, "netstandard20") |
| 10 | + |
| 11 | +@pytest.fixture(scope="session") |
| 12 | +def example_netcore(tmpdir_factory): |
| 13 | + return build_example(tmpdir_factory, "netcoreapp31") |
| 14 | + |
| 15 | +def build_example(tmpdir_factory, framework): |
| 16 | + out = str(tmpdir_factory.mktemp(f"example-{framework}")) |
10 | 17 | proj_path = os.path.join(os.path.dirname(__file__), "../example")
|
11 | 18 |
|
12 |
| - check_call(["dotnet", "build", proj_path, "-o", out, "-f", "netcoreapp31"]) |
| 19 | + check_call(["dotnet", "build", proj_path, "-o", out, "-f", framework]) |
13 | 20 |
|
14 | 21 | return out
|
15 | 22 |
|
16 | 23 |
|
17 | 24 | @pytest.mark.xfail
|
18 |
| -def test_mono(example_dll): |
| 25 | +def test_mono(example_netstandard): |
19 | 26 | from clr_loader import get_mono
|
20 | 27 |
|
21 | 28 | mono = get_mono()
|
22 |
| - asm = mono.get_assembly(os.path.join(example_dll, "example.dll")) |
| 29 | + asm = mono.get_assembly(os.path.join(example_netstandard, "example.dll")) |
23 | 30 |
|
24 | 31 | run_tests(asm)
|
25 | 32 |
|
26 | 33 |
|
27 |
| -def test_coreclr(example_dll): |
| 34 | +def test_coreclr(example_netcore): |
28 | 35 | from clr_loader import get_coreclr
|
29 | 36 |
|
30 |
| - coreclr = get_coreclr(os.path.join(example_dll, "example.runtimeconfig.json")) |
31 |
| - asm = coreclr.get_assembly(os.path.join(example_dll, "example.dll")) |
| 37 | + coreclr = get_coreclr(os.path.join(example_netcore, "example.runtimeconfig.json")) |
| 38 | + asm = coreclr.get_assembly(os.path.join(example_netcore, "example.dll")) |
32 | 39 |
|
33 | 40 | run_tests(asm)
|
34 | 41 |
|
35 | 42 |
|
36 | 43 | @pytest.mark.skipif(sys.platform != 'win32', reason=".NET Framework only exists on Windows")
|
37 |
| -def test_netfx(example_dll): |
| 44 | +def test_netfx(example_netstandard): |
38 | 45 | from clr_loader import get_netfx
|
39 | 46 |
|
40 | 47 | netfx = get_netfx()
|
41 |
| - asm = netfx.get_assembly(os.path.join(example_dll, "example.dll")) |
| 48 | + asm = netfx.get_assembly(os.path.join(example_netstandard, "example.dll")) |
42 | 49 |
|
43 | 50 | run_tests(asm)
|
44 | 51 |
|
|
0 commit comments