46
46
47
47
48
48
class 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
+
49
55
ctx = None
50
56
51
57
def setUp (self ):
@@ -63,6 +69,12 @@ def setUp(self):
63
69
64
70
65
71
class 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
+
66
78
def test_arch (self ):
67
79
arch = Arch (self .ctx )
68
80
with self .assertRaises (AttributeError ) as e1 :
@@ -81,14 +93,28 @@ def test_arch(self):
81
93
82
94
83
95
class 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
+
89
101
@mock .patch ("pythonforandroid.archs.find_executable" )
90
102
@mock .patch ("pythonforandroid.build.ensure_dir" )
91
103
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
+ """
92
118
mock_find_executable .return_value = "arm-linux-androideabi-gcc"
93
119
mock_ensure_dir .return_value = True
94
120
@@ -147,16 +173,30 @@ def test_arch_arm(self, mock_ensure_dir, mock_find_executable):
147
173
148
174
149
175
class 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
+
154
182
@mock .patch ("pythonforandroid.archs.glob" )
155
183
@mock .patch ("pythonforandroid.archs.find_executable" )
156
184
@mock .patch ("pythonforandroid.build.ensure_dir" )
157
185
def test_arch_armv7a (
158
186
self , mock_ensure_dir , mock_find_executable , mock_glob
159
187
):
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
+ """
160
200
mock_find_executable .return_value = "arm-linux-androideabi-gcc"
161
201
mock_ensure_dir .return_value = True
162
202
mock_glob .return_value = ["llvm" ]
@@ -197,9 +237,21 @@ def test_arch_armv7a(
197
237
198
238
199
239
class 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
+
200
245
@mock .patch ("pythonforandroid.archs.find_executable" )
201
246
@mock .patch ("pythonforandroid.build.ensure_dir" )
202
247
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
+ """
203
255
mock_find_executable .return_value = "arm-linux-androideabi-gcc"
204
256
mock_ensure_dir .return_value = True
205
257
@@ -220,9 +272,22 @@ def test_arch_x86(self, mock_ensure_dir, mock_find_executable):
220
272
221
273
222
274
class 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
+
223
281
@mock .patch ("pythonforandroid.archs.find_executable" )
224
282
@mock .patch ("pythonforandroid.build.ensure_dir" )
225
283
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
+ """
226
291
mock_find_executable .return_value = "arm-linux-androideabi-gcc"
227
292
mock_ensure_dir .return_value = True
228
293
@@ -242,9 +307,22 @@ def test_arch_x86_64(self, mock_ensure_dir, mock_find_executable):
242
307
243
308
244
309
class 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
+
245
316
@mock .patch ("pythonforandroid.archs.find_executable" )
246
317
@mock .patch ("pythonforandroid.build.ensure_dir" )
247
318
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
+ """
248
326
mock_find_executable .return_value = "arm-linux-androideabi-gcc"
249
327
mock_ensure_dir .return_value = True
250
328
0 commit comments