Skip to content

Commit f01a78c

Browse files
committed
Fix domain reload tests and activate them on macOS
1 parent fdb7144 commit f01a78c

File tree

1 file changed

+10
-21
lines changed

1 file changed

+10
-21
lines changed

src/domain_tests/test_domain_reload.py

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
import pytest
66

7+
from pythonnet.find_libpython import find_libpython
8+
libpython = find_libpython()
9+
10+
pytestmark = pytest.mark.xfail(libpython is None, reason="Can't find suitable libpython")
11+
12+
713
def _run_test(testname):
814
dirname = os.path.split(__file__)[0]
915
exename = os.path.join(dirname, 'bin', 'Python.DomainReloadTests.exe')
@@ -12,90 +18,73 @@ def _run_test(testname):
1218
if platform.system() != 'Windows':
1319
args = ['mono'] + args
1420

15-
proc = subprocess.Popen(args)
21+
env = os.environ.copy()
22+
env["PYTHONNET_PYDLL"] = libpython
23+
24+
proc = subprocess.Popen(args, env=env)
1625
proc.wait()
1726

1827
assert proc.returncode == 0
1928

20-
@pytest.mark.skipif(platform.system() == 'Darwin', reason='FIXME: macos can\'t find the python library')
2129
def test_rename_class():
2230
_run_test('class_rename')
2331

24-
@pytest.mark.skipif(platform.system() == 'Darwin', reason='FIXME: macos can\'t find the python library')
2532
def test_rename_class_member_static_function():
2633
_run_test('static_member_rename')
2734

28-
@pytest.mark.skipif(platform.system() == 'Darwin', reason='FIXME: macos can\'t find the python library')
2935
def test_rename_class_member_function():
3036
_run_test('member_rename')
3137

32-
@pytest.mark.skipif(platform.system() == 'Darwin', reason='FIXME: macos can\'t find the python library')
3338
def test_rename_class_member_field():
3439
_run_test('field_rename')
3540

36-
@pytest.mark.skipif(platform.system() == 'Darwin', reason='FIXME: macos can\'t find the python library')
3741
def test_rename_class_member_property():
3842
_run_test('property_rename')
3943

40-
@pytest.mark.skipif(platform.system() == 'Darwin', reason='FIXME: macos can\'t find the python library')
4144
def test_rename_namespace():
4245
_run_test('namespace_rename')
4346

44-
@pytest.mark.skipif(platform.system() == 'Darwin', reason='FIXME: macos can\'t find the python library')
4547
def test_field_visibility_change():
4648
_run_test("field_visibility_change")
4749

48-
@pytest.mark.skipif(platform.system() == 'Darwin', reason='FIXME: macos can\'t find the python library')
4950
def test_method_visibility_change():
5051
_run_test("method_visibility_change")
5152

52-
@pytest.mark.skipif(platform.system() == 'Darwin', reason='FIXME: macos can\'t find the python library')
5353
def test_property_visibility_change():
5454
_run_test("property_visibility_change")
5555

56-
@pytest.mark.skipif(platform.system() == 'Darwin', reason='FIXME: macos can\'t find the python library')
5756
def test_class_visibility_change():
5857
_run_test("class_visibility_change")
5958

6059
@pytest.mark.skip(reason='FIXME: Domain reload fails when Python points to a .NET object which points back to Python objects')
61-
@pytest.mark.skipif(platform.system() == 'Darwin', reason='FIXME: macos can\'t find the python library')
6260
def test_method_parameters_change():
6361
_run_test("method_parameters_change")
6462

65-
@pytest.mark.skipif(platform.system() == 'Darwin', reason='FIXME: macos can\'t find the python library')
6663
def test_method_return_type_change():
6764
_run_test("method_return_type_change")
6865

69-
@pytest.mark.skipif(platform.system() == 'Darwin', reason='FIXME: macos can\'t find the python library')
7066
def test_field_type_change():
7167
_run_test("field_type_change")
7268

73-
@pytest.mark.skipif(platform.system() == 'Darwin', reason='FIXME: macos can\'t find the python library')
7469
@pytest.mark.xfail(reason="Events not yet serializable")
7570
def test_rename_event():
7671
_run_test('event_rename')
7772

78-
@pytest.mark.skipif(platform.system() == 'Darwin', reason='FIXME: macos can\'t find the python library')
7973
@pytest.mark.xfail(reason="newly instanced object uses PyType_GenericAlloc")
8074
def test_construct_removed_class():
8175
_run_test("construct_removed_class")
8276

83-
@pytest.mark.skipif(platform.system() == 'Darwin', reason='FIXME: macos can\'t find the python library')
8477
def test_out_to_ref_param():
8578
_run_test("out_to_ref_param")
8679

87-
@pytest.mark.skipif(platform.system() == 'Darwin', reason='FIXME: macos can\'t find the python library')
8880
def test_ref_to_out_param():
8981
_run_test("ref_to_out_param")
9082

91-
@pytest.mark.skipif(platform.system() == 'Darwin', reason='FIXME: macos can\'t find the python library')
9283
def test_ref_to_in_param():
9384
_run_test("ref_to_in_param")
9485

95-
@pytest.mark.skipif(platform.system() == 'Darwin', reason='FIXME: macos can\'t find the python library')
9686
def test_in_to_ref_param():
9787
_run_test("in_to_ref_param")
9888

99-
@pytest.mark.skipif(platform.system() == 'Darwin', reason='FIXME: macos can\'t find the python library')
10089
def test_nested_type():
10190
_run_test("nested_type")

0 commit comments

Comments
 (0)