diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 36426c2..efcf210 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,17 +15,35 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python }} + - name: Install dependencies run: | python -m pip install --upgrade pip pip install pytest cffi + - name: Build run: | pip install -e . + + - name: Cache Mono + if: runner.os == 'Windows' + uses: actions/cache@v2 + with: + path: ${{ env.TEMP }}\chocolatey + key: ${{ runner.os }}-chocolatey + restore-keys: | + ${{ runner.os }}-chocolatey + + - name: Install Mono + if: runner.os == 'Windows' + run: | + choco install -y mono + - name: Test with pytest run: | pytest diff --git a/clr_loader/__init__.py b/clr_loader/__init__.py index a67f4a9..876f1e3 100644 --- a/clr_loader/__init__.py +++ b/clr_loader/__init__.py @@ -53,7 +53,7 @@ def __getitem__(self, path): def get_mono(domain=None, config_file=None, path=None, gc=None): from .mono import Mono - impl = Mono(domain=domain) + impl = Mono(domain=domain, config_file=config_file, path=path, gc=gc) return Runtime(impl) diff --git a/tests/test_common.py b/tests/test_common.py index 7788d34..2a0e23c 100644 --- a/tests/test_common.py +++ b/tests/test_common.py @@ -21,11 +21,24 @@ def build_example(tmpdir_factory, framework): return out -@pytest.mark.xfail def test_mono(example_netstandard): from clr_loader import get_mono - mono = get_mono() + if sys.platform == 'win32': + if sys.maxsize > 2**32: + prog_files = os.environ.get("ProgramFiles") + else: + prog_files = os.environ.get("ProgramFiles(x86)") + + path = fr"{prog_files}\Mono\bin\mono-2.0-sgen.dll" + + elif sys.platform == "darwin": + path = "/Library/Frameworks/Mono.framework/Versions/Current/lib/libmono-2.0.dylib" + + else: + path = None + + mono = get_mono(path=path) asm = mono.get_assembly(os.path.join(example_netstandard, "example.dll")) run_tests(asm)