Skip to content

Commit ff9c1ff

Browse files
committed
Enhance tests on host_tag
1 parent ffc06da commit ff9c1ff

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

tests/test_androidndk.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import unittest
2-
import sys
2+
from unittest import mock
33

44
from pythonforandroid.androidndk import AndroidNDK
55

@@ -15,13 +15,17 @@ def setUp(self):
1515
perform our unittests"""
1616
self.ndk = AndroidNDK("/opt/android/android-ndk")
1717

18-
def test_host_tag(self):
18+
@mock.patch("sys.platform", "linux")
19+
def test_host_tag_linux(self):
1920
"""Test the `host_tag` property of the :class:`~pythonforandroid.androidndk.AndroidNDK`
20-
class."""
21-
if sys.platform == "linux":
22-
self.assertEqual(self.ndk.host_tag, "linux-x86_64")
23-
elif sys.platform == "darwin":
24-
self.assertEqual(self.ndk.host_tag, "darwin-x86_64")
21+
class when the host is Linux."""
22+
self.assertEqual(self.ndk.host_tag, "linux-x86_64")
23+
24+
@mock.patch("sys.platform", "darwin")
25+
def test_host_tag_darwin(self):
26+
"""Test the `host_tag` property of the :class:`~pythonforandroid.androidndk.AndroidNDK`
27+
class when the host is Darwin."""
28+
self.assertEqual(self.ndk.host_tag, "darwin-x86_64")
2529

2630
def test_llvm_prebuilt_dir(self):
2731
"""Test the `llvm_prebuilt_dir` property of the

0 commit comments

Comments
 (0)