4646
4747
4848class ArchSetUpBaseClass (object ):
49+ """
50+ An class object which is intended to be used as a base class to configure
51+ an inherited class of `unittest.TestCase`. This class will override the
52+ `setUp` method.
53+ """
54+
4955 ctx = None
5056
5157 def setUp (self ):
@@ -63,6 +69,12 @@ def setUp(self):
6369
6470
6571class TestArch (ArchSetUpBaseClass , unittest .TestCase ):
72+ """
73+ An inherited class of `ArchSetUpBaseClass` and `unittest.TestCase` which
74+ will be used to perform tests for the base class
75+ :class:`~pythonforandroid.archs.Arch`.
76+ """
77+
6678 def test_arch (self ):
6779 arch = Arch (self .ctx )
6880 with self .assertRaises (AttributeError ) as e1 :
@@ -81,14 +93,28 @@ def test_arch(self):
8193
8294
8395class TestArchARM (ArchSetUpBaseClass , unittest .TestCase ):
84- # Here we mock two functions:
85- # - `ensure_dir` because we don't want to create any directory
86- # - `find_executable` because otherwise we will
87- # get an error when trying to find the compiler (we are setting some fake
88- # paths for our android sdk and ndk so probably will not exist)
96+ """
97+ An inherited class of `ArchSetUpBaseClass` and `unittest.TestCase` which
98+ will be used to perform tests for :class:`~pythonforandroid.archs.ArchARM`.
99+ """
100+
89101 @mock .patch ("pythonforandroid.archs.find_executable" )
90102 @mock .patch ("pythonforandroid.build.ensure_dir" )
91103 def test_arch_arm (self , mock_ensure_dir , mock_find_executable ):
104+ """
105+ Test that class :class:`~pythonforandroid.archs.ArchARM` returns some
106+ expected attributes and environment variables.
107+
108+ .. note::
109+ Here we mock two methods:
110+
111+ - `ensure_dir` because we don't want to create any directory
112+ - `find_executable` because otherwise we will
113+ get an error when trying to find the compiler (we are setting
114+ some fake paths for our android sdk and ndk so probably will
115+ not exist)
116+
117+ """
92118 mock_find_executable .return_value = "arm-linux-androideabi-gcc"
93119 mock_ensure_dir .return_value = True
94120
@@ -147,16 +173,30 @@ def test_arch_arm(self, mock_ensure_dir, mock_find_executable):
147173
148174
149175class TestArchARMv7a (ArchSetUpBaseClass , unittest .TestCase ):
150- # Here we mock the same functions than the previous tests plus `glob`,
151- # so we make sure that the glob result is the expected even if the folder
152- # doesn't exist, which is probably the case. This has to be done because
153- # here we tests the `get_env` with clang
176+ """
177+ An inherited class of `ArchSetUpBaseClass` and `unittest.TestCase` which
178+ will be used to perform tests for
179+ :class:`~pythonforandroid.archs.ArchARMv7_a`.
180+ """
181+
154182 @mock .patch ("pythonforandroid.archs.glob" )
155183 @mock .patch ("pythonforandroid.archs.find_executable" )
156184 @mock .patch ("pythonforandroid.build.ensure_dir" )
157185 def test_arch_armv7a (
158186 self , mock_ensure_dir , mock_find_executable , mock_glob
159187 ):
188+ """
189+ Test that class :class:`~pythonforandroid.archs.ArchARMv7_a` returns
190+ some expected attributes and environment variables.
191+
192+ .. note::
193+ Here we mock the same functions than
194+ :meth:`TestArchARM.test_arch_arm` plus `glob`, so we make sure that
195+ the glob result is the expected even if the folder doesn't exist,
196+ which is probably the case. This has to be done because here we
197+ tests the `get_env` with clang
198+
199+ """
160200 mock_find_executable .return_value = "arm-linux-androideabi-gcc"
161201 mock_ensure_dir .return_value = True
162202 mock_glob .return_value = ["llvm" ]
@@ -197,9 +237,21 @@ def test_arch_armv7a(
197237
198238
199239class TestArchX86 (ArchSetUpBaseClass , unittest .TestCase ):
240+ """
241+ An inherited class of `ArchSetUpBaseClass` and `unittest.TestCase` which
242+ will be used to perform tests for :class:`~pythonforandroid.archs.Archx86`.
243+ """
244+
200245 @mock .patch ("pythonforandroid.archs.find_executable" )
201246 @mock .patch ("pythonforandroid.build.ensure_dir" )
202247 def test_arch_x86 (self , mock_ensure_dir , mock_find_executable ):
248+ """
249+ Test that class :class:`~pythonforandroid.archs.Archx86` returns
250+ some expected attributes and environment variables.
251+
252+ .. note:: Here we mock the same functions than
253+ :meth:`TestArchARM.test_arch_arm`
254+ """
203255 mock_find_executable .return_value = "arm-linux-androideabi-gcc"
204256 mock_ensure_dir .return_value = True
205257
@@ -220,9 +272,22 @@ def test_arch_x86(self, mock_ensure_dir, mock_find_executable):
220272
221273
222274class TestArchX86_64 (ArchSetUpBaseClass , unittest .TestCase ):
275+ """
276+ An inherited class of `ArchSetUpBaseClass` and `unittest.TestCase` which
277+ will be used to perform tests for
278+ :class:`~pythonforandroid.archs.Archx86_64`.
279+ """
280+
223281 @mock .patch ("pythonforandroid.archs.find_executable" )
224282 @mock .patch ("pythonforandroid.build.ensure_dir" )
225283 def test_arch_x86_64 (self , mock_ensure_dir , mock_find_executable ):
284+ """
285+ Test that class :class:`~pythonforandroid.archs.Archx86_64` returns
286+ some expected attributes and environment variables.
287+
288+ .. note:: Here we mock the same functions than
289+ :meth:`TestArchARM.test_arch_arm`
290+ """
226291 mock_find_executable .return_value = "arm-linux-androideabi-gcc"
227292 mock_ensure_dir .return_value = True
228293
@@ -242,9 +307,22 @@ def test_arch_x86_64(self, mock_ensure_dir, mock_find_executable):
242307
243308
244309class TestArchAArch64 (ArchSetUpBaseClass , unittest .TestCase ):
310+ """
311+ An inherited class of `ArchSetUpBaseClass` and `unittest.TestCase` which
312+ will be used to perform tests for
313+ :class:`~pythonforandroid.archs.ArchAarch_64`.
314+ """
315+
245316 @mock .patch ("pythonforandroid.archs.find_executable" )
246317 @mock .patch ("pythonforandroid.build.ensure_dir" )
247318 def test_arch_aarch_64 (self , mock_ensure_dir , mock_find_executable ):
319+ """
320+ Test that class :class:`~pythonforandroid.archs.ArchAarch_64` returns
321+ some expected attributes and environment variables.
322+
323+ .. note:: Here we mock the same functions than
324+ :meth:`TestArchARM.test_arch_arm`
325+ """
248326 mock_find_executable .return_value = "arm-linux-androideabi-gcc"
249327 mock_ensure_dir .return_value = True
250328
0 commit comments