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
+ """
49
54
ctx = None
50
55
51
56
def setUp (self ):
@@ -63,6 +68,11 @@ def setUp(self):
63
68
64
69
65
70
class TestArch (ArchSetUpBaseClass , unittest .TestCase ):
71
+ """
72
+ An inherited class of `ArchSetUpBaseClass` and `unittest.TestCase` which
73
+ will be used to perform tests for the base class
74
+ :class:`~pythonforandroid.archs.Arch`.
75
+ """
66
76
def test_arch (self ):
67
77
arch = Arch (self .ctx )
68
78
with self .assertRaises (AttributeError ) as e1 :
@@ -81,14 +91,27 @@ def test_arch(self):
81
91
82
92
83
93
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)
94
+ """
95
+ An inherited class of `ArchSetUpBaseClass` and `unittest.TestCase` which
96
+ will be used to perform tests for :class:`~pythonforandroid.archs.ArchARM`.
97
+ """
89
98
@mock .patch ("pythonforandroid.archs.find_executable" )
90
99
@mock .patch ("pythonforandroid.build.ensure_dir" )
91
100
def test_arch_arm (self , mock_ensure_dir , mock_find_executable ):
101
+ """
102
+ Test that class :class:`~pythonforandroid.archs.ArchARM` returns some
103
+ expected attributes and environment variables.
104
+
105
+ .. note::
106
+ Here we mock two methods:
107
+
108
+ - `ensure_dir` because we don't want to create any directory
109
+ - `find_executable` because otherwise we will
110
+ get an error when trying to find the compiler (we are setting
111
+ some fake paths for our android sdk and ndk so probably will
112
+ not exist)
113
+
114
+ """
92
115
mock_find_executable .return_value = "arm-linux-androideabi-gcc"
93
116
mock_ensure_dir .return_value = True
94
117
@@ -147,16 +170,30 @@ def test_arch_arm(self, mock_ensure_dir, mock_find_executable):
147
170
148
171
149
172
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
173
+ """
174
+ An inherited class of `ArchSetUpBaseClass` and `unittest.TestCase` which
175
+ will be used to perform tests for
176
+ :class:`~pythonforandroid.archs.ArchARMv7_a`.
177
+ """
178
+
154
179
@mock .patch ("pythonforandroid.archs.glob" )
155
180
@mock .patch ("pythonforandroid.archs.find_executable" )
156
181
@mock .patch ("pythonforandroid.build.ensure_dir" )
157
182
def test_arch_armv7a (
158
183
self , mock_ensure_dir , mock_find_executable , mock_glob
159
184
):
185
+ """
186
+ Test that class :class:`~pythonforandroid.archs.ArchARMv7_a` returns
187
+ some expected attributes and environment variables.
188
+
189
+ .. note::
190
+ Here we mock the same functions than
191
+ :meth:`TestArchARM.test_arch_arm` plus `glob`, so we make sure that
192
+ the glob result is the expected even if the folder doesn't exist,
193
+ which is probably the case. This has to be done because here we
194
+ tests the `get_env` with clang
195
+
196
+ """
160
197
mock_find_executable .return_value = "arm-linux-androideabi-gcc"
161
198
mock_ensure_dir .return_value = True
162
199
mock_glob .return_value = ["llvm" ]
@@ -197,9 +234,20 @@ def test_arch_armv7a(
197
234
198
235
199
236
class TestArchX86 (ArchSetUpBaseClass , unittest .TestCase ):
237
+ """
238
+ An inherited class of `ArchSetUpBaseClass` and `unittest.TestCase` which
239
+ will be used to perform tests for :class:`~pythonforandroid.archs.Archx86`.
240
+ """
200
241
@mock .patch ("pythonforandroid.archs.find_executable" )
201
242
@mock .patch ("pythonforandroid.build.ensure_dir" )
202
243
def test_arch_x86 (self , mock_ensure_dir , mock_find_executable ):
244
+ """
245
+ Test that class :class:`~pythonforandroid.archs.Archx86` returns
246
+ some expected attributes and environment variables.
247
+
248
+ .. note:: Here we mock the same functions than
249
+ :meth:`TestArchARM.test_arch_arm`
250
+ """
203
251
mock_find_executable .return_value = "arm-linux-androideabi-gcc"
204
252
mock_ensure_dir .return_value = True
205
253
@@ -220,9 +268,21 @@ def test_arch_x86(self, mock_ensure_dir, mock_find_executable):
220
268
221
269
222
270
class TestArchX86_64 (ArchSetUpBaseClass , unittest .TestCase ):
271
+ """
272
+ An inherited class of `ArchSetUpBaseClass` and `unittest.TestCase` which
273
+ will be used to perform tests for
274
+ :class:`~pythonforandroid.archs.Archx86_64`.
275
+ """
223
276
@mock .patch ("pythonforandroid.archs.find_executable" )
224
277
@mock .patch ("pythonforandroid.build.ensure_dir" )
225
278
def test_arch_x86_64 (self , mock_ensure_dir , mock_find_executable ):
279
+ """
280
+ Test that class :class:`~pythonforandroid.archs.Archx86_64` returns
281
+ some expected attributes and environment variables.
282
+
283
+ .. note:: Here we mock the same functions than
284
+ :meth:`TestArchARM.test_arch_arm`
285
+ """
226
286
mock_find_executable .return_value = "arm-linux-androideabi-gcc"
227
287
mock_ensure_dir .return_value = True
228
288
@@ -242,9 +302,21 @@ def test_arch_x86_64(self, mock_ensure_dir, mock_find_executable):
242
302
243
303
244
304
class TestArchAArch64 (ArchSetUpBaseClass , unittest .TestCase ):
305
+ """
306
+ An inherited class of `ArchSetUpBaseClass` and `unittest.TestCase` which
307
+ will be used to perform tests for
308
+ :class:`~pythonforandroid.archs.ArchAarch_64`.
309
+ """
245
310
@mock .patch ("pythonforandroid.archs.find_executable" )
246
311
@mock .patch ("pythonforandroid.build.ensure_dir" )
247
312
def test_arch_aarch_64 (self , mock_ensure_dir , mock_find_executable ):
313
+ """
314
+ Test that class :class:`~pythonforandroid.archs.ArchAarch_64` returns
315
+ some expected attributes and environment variables.
316
+
317
+ .. note:: Here we mock the same functions than
318
+ :meth:`TestArchARM.test_arch_arm`
319
+ """
248
320
mock_find_executable .return_value = "arm-linux-androideabi-gcc"
249
321
mock_ensure_dir .return_value = True
250
322
0 commit comments