searxng/tests/unit
Markus Heiser bb04699b17 [fix] unit tests: call searx.search.initialize in test's setUp
Depending on the order the unit tests are executed, the searx.search module is
initalized or not, issue reported in [1]::

    Traceback (most recent call last):
      File "searxng/tests/unit/test_results.py", line 72, in test_result_merge_by_title
        self.container.extend('stract', [fake_result(engine='stract', title='short title')])
      File "searxng/searx/results.py", line 243, in extend
        histogram_observe(standard_result_count, 'engine', engine_name, 'result', 'count')
      File "searxng/searx/metrics/__init__.py", line 49, in histogram_observe
        histogram_storage.get(*args).observe(duration)
        ^^^^^^^^^^^^^^^^^^^^^
      AttributeError: 'NoneType' object has no attribute 'get'

To ensure that the searx.search module is initialized, the

- searx.engines.load_engines is replace by
- searx.search.initialize

[1] https://github.com/searxng/searxng/pull/3932#discussion_r1822406569

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2024-11-29 15:26:03 +01:00
..
engines [fix] unit test_xpath.py: name 'logger' is not defined 2024-06-28 08:54:19 +02:00
network [mod] pylint all files with one profile / drop PYLINT_SEARXNG_DISABLE_OPTION 2024-03-11 14:55:38 +01:00
processors [fix] unit tests: call searx.search.initialize in test's setUp 2024-11-29 15:26:03 +01:00
settings [feat] add favicons to result urls 2024-10-05 08:18:28 +02:00
__init__.py [mod] pylint all files with one profile / drop PYLINT_SEARXNG_DISABLE_OPTION 2024-03-11 14:55:38 +01:00
test_answerers.py [refactor] unit tests to utilize paramaterized and break down monolithic tests 2024-10-03 13:20:32 +02:00
test_engine_mariadb_server.py [fix] unit tests: call searx.search.initialize in test's setUp 2024-11-29 15:26:03 +01:00
test_engine_tineye.py [fix] unit tests: call searx.search.initialize in test's setUp 2024-11-29 15:26:03 +01:00
test_engines_init.py [fix] unit tests: fix load / unload engines & fix messages 2024-08-21 08:28:13 +02:00
test_exceptions.py [refactor] unit tests to utilize paramaterized and break down monolithic tests 2024-10-03 13:20:32 +02:00
test_external_bangs.py [refactor] unit tests to utilize paramaterized and break down monolithic tests 2024-10-03 13:20:32 +02:00
test_locales.py [enh] engine: mojeek - add language support 2024-10-15 06:37:01 +02:00
test_plugin_calculator.py [fix] calculator: use locale from UI (not from selected language) 2024-10-28 15:53:57 +01:00
test_plugin_hash.py [refactor] unit tests (continued) - plugins 2024-10-15 08:10:52 +02:00
test_plugin_self_info.py [refactor] unit tests (continued) - plugins 2024-10-15 08:10:52 +02:00
test_plugins.py [fix] float operations in calculator plugin 2024-10-15 08:10:52 +02:00
test_preferences.py [test] add additional tests for preferences 2024-11-24 19:55:21 +01:00
test_query.py [fix] unit tests: call searx.search.initialize in test's setUp 2024-11-29 15:26:03 +01:00
test_results.py [fix] unit tests: call searx.search.initialize in test's setUp 2024-11-29 15:26:03 +01:00
test_search.py [refactor] unit tests to utilize paramaterized and break down monolithic tests 2024-10-03 13:20:32 +02:00
test_settings_loader.py [refactor] unit tests to utilize paramaterized and break down monolithic tests 2024-10-03 13:20:32 +02:00
test_toml.py [mod] add test to check compat.py module 2024-10-26 15:59:42 +02:00
test_utils.py [refactor] unit tests (continued) - plugins 2024-10-15 08:10:52 +02:00
test_webadapter.py [mod] pylint all files with one profile / drop PYLINT_SEARXNG_DISABLE_OPTION 2024-03-11 14:55:38 +01:00
test_webapp.py [chore] rss: rename from searx to SearXNG 2024-11-25 09:34:02 +01:00
test_webutils.py [refactor] unit tests to utilize paramaterized and break down monolithic tests 2024-10-03 13:20:32 +02:00