on master help sign in
searx/testing.py: pylint & SPDX tag (no functional change)

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>

commit4a94b4cca6e609856cf717dfae5d7ea4a1df0469 authorMarkus Heiser <markus.heiser@darmarit.de> dateSun 23 Feb 2020, 22:51 (7 years ago) parent1cae4fa
2 files changed+10−11
Makefile+1 searx/testing.py+9−11
Makefile+1
@@ -77,6 +77,7 @@ test: test.pylint test.pep8 test.unit test.robot
7777# TODO: balance linting with pylint
7878test.pylint: pylint-exe
7979 $(call cmd,pylint,searx/preferences.py)
80+ $(call cmd,pylint,searx/testing.py)
8081
8182test.pep8: pyenvinstall
8283 $(PY_ENV_ACT); ./manage.sh pep8_check
searx/testing.py+9−11
@@ -1,37 +1,38 @@
11# -*- coding: utf-8 -*-
2+# SPDX-License-Identifier: AGPL-3.0-or-later
23"""Shared testing code."""
34
5+# pylint: disable=missing-function-docstring
46
57import os
68import subprocess
79import traceback
810
9−from os.path import dirname, join, abspath
11+from os.path import dirname, join, abspath, realpath
1012
1113from splinter import Browser
1214from unittest2 import TestCase
1315
14−
1516class SearxTestLayer:
1617 """Base layer for non-robot tests."""
1718
1819 __name__ = u'SearxTestLayer'
1920
21+ @classmethod
2022 def setUp(cls):
2123 pass
22− setUp = classmethod(setUp)
2324
25+ @classmethod
2426 def tearDown(cls):
2527 pass
26− tearDown = classmethod(tearDown)
2728
29+ @classmethod
2830 def testSetUp(cls):
2931 pass
30− testSetUp = classmethod(testSetUp)
3132
33+ @classmethod
3234 def testTearDown(cls):
3335 pass
34− testTearDown = classmethod(testTearDown)
3536
3637
3738class SearxRobotLayer():
@@ -41,10 +42,7 @@ class SearxRobotLayer():
4142 os.setpgrp() # create new process group, become its leader
4243
4344 # get program paths
44− webapp = os.path.join(
45− os.path.abspath(os.path.dirname(os.path.realpath(__file__))),
46− 'webapp.py'
47− )
45+ webapp = join(abspath(dirname(realpath(__file__))), 'webapp.py')
4846 exe = 'python'
4947
5048 # set robot settings path
@@ -105,7 +103,7 @@ if __name__ == '__main__':
105103 try:
106104 test_layer.setUp()
107105 run_robot_tests([getattr(robot, x) for x in dir(robot) if x.startswith('test_')])
108− except Exception:
106+ except Exception: # pylint: disable=broad-except
109107 errors = True
110108 print('Error occured: {0}'.format(traceback.format_exc()))
111109 test_layer.tearDown()