Skip to content

Commit 99fdbf8

Browse files
committed
Pretend to be on macOS if running on Linux, and vice versa
Hack test_load_libgmt_fails, so that if on Linux, sys.platform returns 'darwin', and if on macOS, sys.platform returns 'linux'.
1 parent 486c37a commit 99fdbf8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pygmt/tests/test_clib_loading.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,12 @@ def test_load_libgmt_fails(monkeypatch):
7373
be found.
7474
"""
7575
with monkeypatch.context() as mpatch:
76-
mpatch.setattr(sys, "platform", "darwin") # pretend to be on macOS
76+
mpatch.setattr(
77+
sys,
78+
"platform",
79+
# Pretend to be on macOS if running on Linux, and vice versa
80+
"darwin" if sys.platform == "linux" else "linux",
81+
)
7782
mpatch.setattr(
7883
subprocess, "check_output", lambda cmd, encoding: "libfakegmt.so"
7984
)

0 commit comments

Comments
 (0)