Skip to content

Commit d44c481

Browse files
dbnicholsonrtibbles
authored andcommitted
Fix flake8 warnings in on device unit tests
These are cosmetic but they make it easier to use flake8 to find issues when hacking on the app.
1 parent 9decb96 commit d44c481

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

testapps/on_device_unit_tests/setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
'ndk-api': 21,
4747
'dist-name': 'bdist_unit_tests_app',
4848
'arch': 'armeabi-v7a',
49-
'bootstrap' : 'sdl2',
49+
'bootstrap': 'sdl2',
5050
'permissions': ['INTERNET', 'VIBRATE'],
5151
'orientation': ['portrait', 'landscape'],
5252
'service': 'P4a_test_service:app_service.py',
@@ -60,19 +60,19 @@
6060
'ndk-api': 21,
6161
'dist-name': 'bdist_unit_tests_app',
6262
'arch': 'armeabi-v7a',
63-
'bootstrap' : 'sdl2',
63+
'bootstrap': 'sdl2',
6464
'permissions': ['INTERNET', 'VIBRATE'],
6565
'orientation': ['portrait', 'landscape'],
6666
'service': 'P4a_test_service:app_service.py',
6767
},
6868
'aar':
6969
{
70-
'requirements' : 'python3',
70+
'requirements': 'python3',
7171
'android-api': 27,
7272
'ndk-api': 21,
7373
'dist-name': 'bdist_unit_tests_app',
7474
'arch': 'arm64-v8a',
75-
'bootstrap' : 'service_library',
75+
'bootstrap': 'service_library',
7676
'permissions': ['INTERNET', 'VIBRATE'],
7777
'service': 'P4a_test_service:app_service.py',
7878
}

testapps/on_device_unit_tests/test_app/tests/test_requirements.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,27 @@ def test_run_module(self):
1010
import numpy as np
1111

1212
arr = np.random.random((3, 3))
13-
det = np.linalg.det(arr)
13+
np.linalg.det(arr)
14+
1415

1516
class ScipyTestCase(PythonTestMixIn, TestCase):
1617
module_import = 'scipy'
1718

1819
def test_run_module(self):
1920
import numpy as np
20-
from scipy.cluster.vq import vq, kmeans, whiten
21-
features = np.array([[ 1.9,2.3],
22-
[ 1.5,2.5],
23-
[ 0.8,0.6],
24-
[ 0.4,1.8],
25-
[ 0.1,0.1],
26-
[ 0.2,1.8],
27-
[ 2.0,0.5],
28-
[ 0.3,1.5],
29-
[ 1.0,1.0]])
21+
from scipy.cluster.vq import kmeans, whiten
22+
features = np.array([[1.9, 2.3],
23+
[1.5, 2.5],
24+
[0.8, 0.6],
25+
[0.4, 1.8],
26+
[0.1, 0.1],
27+
[0.2, 1.8],
28+
[2.0, 0.5],
29+
[0.3, 1.5],
30+
[1.0, 1.0]])
3031
whitened = whiten(features)
31-
book = np.array((whitened[0],whitened[2]))
32-
print('kmeans', kmeans(whitened,book))
32+
book = np.array((whitened[0], whitened[2]))
33+
print('kmeans', kmeans(whitened, book))
3334

3435

3536
class OpensslTestCase(PythonTestMixIn, TestCase):
@@ -58,7 +59,7 @@ class KivyTestCase(PythonTestMixIn, TestCase):
5859
def test_run_module(self):
5960
# This import has side effects, if it works then it's an
6061
# indication that Kivy is okay
61-
from kivy.core.window import Window
62+
from kivy.core.window import Window # noqa: F401
6263

6364

6465
class PyjniusTestCase(PythonTestMixIn, TestCase):
@@ -102,7 +103,6 @@ def test_run_module(self):
102103
import os
103104
from PIL import (
104105
Image as PilImage,
105-
ImageOps,
106106
ImageFont,
107107
ImageDraw,
108108
ImageFilter,
@@ -175,7 +175,7 @@ def test_run_module(self):
175175
f = Fernet(key)
176176
cryptography_encrypted = f.encrypt(
177177
b'A really secret message. Not for prying eyes.')
178-
cryptography_decrypted = f.decrypt(cryptography_encrypted)
178+
f.decrypt(cryptography_encrypted)
179179

180180

181181
class PycryptoTestCase(PythonTestMixIn, TestCase):
@@ -187,7 +187,7 @@ def test_run_module(self):
187187
crypto_hash_message = 'A secret message'
188188
hash = SHA256.new()
189189
hash.update(crypto_hash_message)
190-
crypto_hash_hexdigest = hash.hexdigest()
190+
hash.hexdigest()
191191

192192

193193
class PycryptodomeTestCase(PythonTestMixIn, TestCase):
@@ -211,7 +211,7 @@ def test_run_module(self):
211211
'ok' if os.path.exists("rsa_key.bin") else 'fail'))
212212
self.assertTrue(os.path.exists("rsa_key.bin"))
213213

214-
print('\t -> Testing Public key:'.format(key.publickey().export_key()))
214+
print('\t -> Testing Public key: {}'.format(key.publickey().export_key()))
215215

216216

217217
class ScryptTestCase(PythonTestMixIn, TestCase):
@@ -229,7 +229,7 @@ class M2CryptoTestCase(PythonTestMixIn, TestCase):
229229

230230
def test_run_module(self):
231231
from M2Crypto import SSL
232-
ctx = SSL.Context('sslv23')
232+
SSL.Context('sslv23')
233233

234234

235235
class Pysha3TestCase(PythonTestMixIn, TestCase):

testapps/on_device_unit_tests/test_app/tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def raise_error(error):
5555
try:
5656
from widgets import ErrorPopup
5757
except ImportError:
58-
print('raise_error:', error)
58+
print('raise_error:', error)
5959
return
6060
ErrorPopup(error_text=error).open()
6161

0 commit comments

Comments
 (0)