mirror of
https://github.com/searxng/searxng.git
synced 2024-11-16 17:40:11 +01:00
542f7d0d7b
In the past, some files were tested with the standard profile, others with a profile in which most of the messages were switched off ... some files were not checked at all. - ``PYLINT_SEARXNG_DISABLE_OPTION`` has been abolished - the distinction ``# lint: pylint`` is no longer necessary - the pylint tasks have been reduced from three to two 1. ./searx/engines -> lint engines with additional builtins 2. ./searx ./searxng_extra ./tests -> lint all other python files Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
58 lines
1.2 KiB
Python
58 lines
1.2 KiB
Python
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
# pylint: disable=missing-module-docstring
|
|
|
|
import os
|
|
import aiounittest
|
|
|
|
os.environ.pop('SEARX_DEBUG', None)
|
|
os.environ.pop('SEARX_DEBUG_LOG_LEVEL', None)
|
|
os.environ.pop('SEARX_DISABLE_ETC_SETTINGS', None)
|
|
os.environ.pop('SEARX_SETTINGS_PATH', None)
|
|
|
|
os.environ.pop('SEARXNG_SETTINGS_PATH', None)
|
|
|
|
os.environ['SEARXNG_DEBUG'] = '1'
|
|
os.environ['SEARXNG_DEBUG_LOG_LEVEL'] = 'WARNING'
|
|
os.environ['SEARXNG_DISABLE_ETC_SETTINGS'] = '1'
|
|
|
|
|
|
class SearxTestLayer:
|
|
"""Base layer for non-robot tests."""
|
|
|
|
__name__ = 'SearxTestLayer'
|
|
|
|
@classmethod
|
|
def setUp(cls):
|
|
pass
|
|
|
|
@classmethod
|
|
def tearDown(cls):
|
|
pass
|
|
|
|
@classmethod
|
|
def testSetUp(cls):
|
|
pass
|
|
|
|
@classmethod
|
|
def testTearDown(cls):
|
|
pass
|
|
|
|
|
|
class SearxTestCase(aiounittest.AsyncTestCase):
|
|
"""Base test case for non-robot tests."""
|
|
|
|
layer = SearxTestLayer
|
|
|
|
def setattr4test(self, obj, attr, value):
|
|
"""
|
|
setattr(obj, attr, value)
|
|
but reset to the previous value in the cleanup.
|
|
"""
|
|
previous_value = getattr(obj, attr)
|
|
|
|
def cleanup_patch():
|
|
setattr(obj, attr, previous_value)
|
|
|
|
self.addCleanup(cleanup_patch)
|
|
setattr(obj, attr, value)
|