From 4dca65890e88b4d229473e828f0b9cd9d7e7a37e Mon Sep 17 00:00:00 2001 From: Carmen Tawalika Date: Thu, 5 Dec 2024 10:05:17 +0100 Subject: [PATCH] Introduce ruff (#574) * rename location * fixes for tests and G83 * fix job resumption tests * linting * initial ruff check * update test imports * lint * F841 and Post-PR * lint * test with wip linting workflow * test post-pr * fix ref * trigger build * always-post-pr * post-pr in separate workflow * rename workflow * fix lint error * trigger pipelines * add ruff config * update post-pr workflow * Update .github/workflows/linting.yml * fix tests --------- Co-authored-by: anikaweinmann --- .github/workflows/linting.yml | 7 +- .github/workflows/post-pr-reviews.yml | 11 + ruff.toml | 188 ++++++++++++++++++ src/actinia_core/core/common/api_logger.py | 3 +- src/actinia_core/core/common/app.py | 20 +- .../google_satellite_bigquery_interface.py | 2 +- src/actinia_core/core/common/process_chain.py | 4 +- src/actinia_core/core/common/process_queue.py | 6 +- src/actinia_core/core/grass_init.py | 2 +- src/actinia_core/core/list_grass_modules.py | 137 ------------- src/actinia_core/core/resources_logger.py | 6 +- .../core/stac_exporter_interface.py | 2 +- src/actinia_core/main.py | 3 +- .../ephemeral_processing_with_export.py | 8 +- .../ephemeral_processing.py | 23 +-- .../persistent/map_layer_management.py | 2 +- .../rest/process_chain_monitoring.py | 4 +- src/actinia_core/testsuite.py | 3 +- tests/test_async_processing_import_export.py | 3 +- tests/test_noauth.py | 13 +- tests/test_process_queue.py | 2 + tests/test_resource_base.py | 2 + .../test_sentinel2_processing_commands.py | 2 +- 23 files changed, 263 insertions(+), 190 deletions(-) create mode 100644 .github/workflows/post-pr-reviews.yml create mode 100644 ruff.toml delete mode 100644 src/actinia_core/core/list_grass_modules.py diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 02f7e8f69..5574c0d8c 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -1,6 +1,11 @@ name: Linting and code quality check -on: [push, pull_request] +on: + push: + branches: + - main + - develop + pull_request: jobs: lint: diff --git a/.github/workflows/post-pr-reviews.yml b/.github/workflows/post-pr-reviews.yml new file mode 100644 index 000000000..b026cf3ff --- /dev/null +++ b/.github/workflows/post-pr-reviews.yml @@ -0,0 +1,11 @@ +name: Post PR code suggestions + +on: + workflow_run: + workflows: ["Linting and code quality check"] + types: + - completed + +jobs: + post-pr-reviews: + uses: mundialis/github-workflows/.github/workflows/post-pr-reviews.yml@main diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 000000000..fdfcb4160 --- /dev/null +++ b/ruff.toml @@ -0,0 +1,188 @@ +# Extends https://github.com/mundialis/github-workflows/blob/main/linting-config-examples/ruff.toml + +lint.ignore = [ + # See https://docs.astral.sh/ruff/rules/ + # TODO: fix lint issues or use lint_per-file-ignores + "A001", + "A002", + "A004", + "ANN001", + "ANN002", + "ANN003", + "ANN201", + "ANN202", + "ANN204", + "ANN205", + "ANN206", + "ARG001", + "ARG002", + "B006", + "B007", + "B018", + "B904", + "BLE001", + "COM812", + "D100", + "D101", + "D102", + "D103", + "D104", + "D105", + "D107", + "D200", + "D202", + "D205", + "D208", + "D209", + "D212", + "D213", + "D214", + "D301", + "D400", + "D401", + "D402", + "D403", + "D404", + "D411", + "D412", + "D413", + "D414", + "D415", + "D417", + "D419", + "DTZ003", + "DTZ005", + "E501", + "FBT002", + "FBT003", + "FURB101", + "FURB103", + "FURB113", + "FURB118", + "FURB154", + "FURB171", + "G002", + "G003", + "G004", + "I001", + "ICN001", + "ISC001", + "ISC003", + "N802", + "N806", + "N814", + "N818", + "PERF102", + "PERF203", + "PERF401", + "PIE790", + "PLC0206", + "PLC0415", + "PLC1901", + "PLR0904", + "PLR0911", + "PLR0912", + "PLR0913", + "PLR0914", + "PLR0915", + "PLR0917", + "PLR1702", + "PLR1704", + "PLR1711", + "PLR1714", + "PLR1722", + "PLR1730", + "PLR2004", + "PLR5501", + "PLR6104", + "PLR6201", + "PLR6301", + "PLW0127", + "PLW0133", + "PLW0602", + "PLW0603", + "PLW1510", + "PLW1514", + "PLW2901", + "PT006", + "PT009", + "PT027", + "PTH100", + "PTH101", + "PTH102", + "PTH103", + "PTH104", + "PTH105", + "PTH107", + "PTH109", + "PTH110", + "PTH112", + "PTH113", + "PTH118", + "PTH119", + "PTH120", + "PTH122", + "PTH123", + "PTH202", + "RET503", + "RET504", + "RET505", + "RET506", + "RET508", + "RUF010", + "RUF012", + "RUF015", + "RUF019", + "S101", + "S102", + "S104", + "S105", + "S106", + "S107", + "S108", + "S110", + "S113", + "S301", + "S307", + "S310", + "S311", + "S314", + "S403", + "S404", + "S405", + "S603", + "S605", + "S606", + "S607", + "S608", + "SIM102", + "SIM103", + "SIM105", + "SIM108", + "SIM113", + "SIM114", + "SIM115", + "SIM118", + "SIM300", + "SIM401", + "SLF001", + "TID252", + "TRY002", + "TRY003", + "TRY201", + "TRY203", + "TRY300", + "TRY301", + "TRY400", + "UP004", + "UP008", + "UP009", + "UP015", + "UP024", + "UP031", + "UP032", +] + +# [lint.per-file-ignores] +# Define file-specific linting rule ignores +# "lib_dop/r_dop_import_lib.py" = ["ERA001", "PLR2004"] diff --git a/src/actinia_core/core/common/api_logger.py b/src/actinia_core/core/common/api_logger.py index 9c788d8d0..1652225ab 100644 --- a/src/actinia_core/core/common/api_logger.py +++ b/src/actinia_core/core/common/api_logger.py @@ -36,7 +36,8 @@ from fluent import sender from fluent import event - has_fluent = True + if sender and event: + has_fluent = True except Exception: has_fluent = False diff --git a/src/actinia_core/core/common/app.py b/src/actinia_core/core/common/app.py index 4c5932d86..09788b52d 100644 --- a/src/actinia_core/core/common/app.py +++ b/src/actinia_core/core/common/app.py @@ -25,6 +25,16 @@ App configuration of flask, flask_restful, redis server connection and global settings """ +from flask_httpauth import HTTPBasicAuth +from flask_httpauth import HTTPTokenAuth +from flask_cors import CORS +from flask import Flask +from flask_restful_swagger_2 import Api + +from actinia_core.core.common.config import global_config, DEFAULT_CONFIG_PATH + +from actinia_api import API_VERSION, URL_PREFIX + actinia_string = """Actinia""" actinia_description = """ @@ -105,16 +115,6 @@ a cloud storage for download. """ -from flask_httpauth import HTTPBasicAuth -from flask_httpauth import HTTPTokenAuth -from flask_cors import CORS -from flask import Flask -from flask_restful_swagger_2 import Api - -from actinia_core.core.common.config import global_config, DEFAULT_CONFIG_PATH - -from actinia_api import API_VERSION, URL_PREFIX - __license__ = "GPLv3" __author__ = "Sören Gebbert, Julia Haas, Anika Weinmann" __copyright__ = ( diff --git a/src/actinia_core/core/common/google_satellite_bigquery_interface.py b/src/actinia_core/core/common/google_satellite_bigquery_interface.py index 0d86bda1a..41e0ebc7c 100644 --- a/src/actinia_core/core/common/google_satellite_bigquery_interface.py +++ b/src/actinia_core/core/common/google_satellite_bigquery_interface.py @@ -827,7 +827,7 @@ def get_sentinel_urls(self, product_ids, bands=None): # The whole XML content is returned as well ( gml, - xml_metadata, + _, bbox, ) = self._generate_sentinel2_footprint(base_url=base_url) result[product_id]["gml_footprint"] = gml diff --git a/src/actinia_core/core/common/process_chain.py b/src/actinia_core/core/common/process_chain.py index fb615ceae..db00ef84a 100644 --- a/src/actinia_core/core/common/process_chain.py +++ b/src/actinia_core/core/common/process_chain.py @@ -275,7 +275,7 @@ def _get_landsat_import_download_commands(self, entry): scene_id=scene, ) - download_commands, import_file_info = lp.get_download_process_list() + download_commands, _ = lp.get_download_process_list() import_commands = lp.get_import_process_list() atcor_commands = lp.get_i_landsat_toar_process_list(atcor) landsat_commands = download_commands @@ -332,7 +332,7 @@ def _get_sentinel_import_command(self, entry): import_commands = sp.get_sentinel2_import_process_list() sentinel_commands.extend(import_commands) - input_file, map_name = import_file_info[band] + _, map_name = import_file_info[band] p = Process( exec_type="grass", executable="g.rename", diff --git a/src/actinia_core/core/common/process_queue.py b/src/actinia_core/core/common/process_queue.py index 5fe52e0cc..eda79cdd2 100644 --- a/src/actinia_core/core/common/process_queue.py +++ b/src/actinia_core/core/common/process_queue.py @@ -37,7 +37,6 @@ import queue as standard_queue from multiprocessing import Process, Queue from threading import Thread, Lock -import logging import atexit from actinia_core.core.resources_logger import ResourceLogger from actinia_core.core.logging_interface import log @@ -48,7 +47,8 @@ try: from fluent import handler - has_fluent = True + if handler: + has_fluent = True except Exception: print("Fluent is not available") has_fluent = False @@ -247,7 +247,7 @@ def check_exit(self): ) if response_data is not None: - http_code, response_model = pickle.loads(response_data) + _, response_model = pickle.loads(response_data) if ( response_model["status"] != "error" and response_model["status"] != "terminated" diff --git a/src/actinia_core/core/grass_init.py b/src/actinia_core/core/grass_init.py index 813ea82fb..7ed740221 100644 --- a/src/actinia_core/core/grass_init.py +++ b/src/actinia_core/core/grass_init.py @@ -599,7 +599,7 @@ def setup_tmp_region(self): """ # Safe the current region in a temporary region that can be overwritten - errorid, stdout_buff, stderr_buff = self.run_module( + errorid, _, _ = self.run_module( "g.region", ["save=%s" % self.tmp_region_name, "--o"] ) diff --git a/src/actinia_core/core/list_grass_modules.py b/src/actinia_core/core/list_grass_modules.py deleted file mode 100644 index f2e8337bb..000000000 --- a/src/actinia_core/core/list_grass_modules.py +++ /dev/null @@ -1,137 +0,0 @@ -# -*- coding: utf-8 -*- -####### -# actinia-core - an open source REST API for scalable, distributed, high -# performance processing of geographical data that uses GRASS GIS for -# computational tasks. For details, see https://actinia.mundialis.de/ -# -# Copyright (c) 2016-2018 Sören Gebbert and mundialis GmbH & Co. KG -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -####### - -""" -XML to module list -AW: I suspect that this file is no longer used - because of F821: undefined names after missing import PyQt4 - PyQt4 is obsolete and since python3 PyQt5 is used -""" - -# from PyQt4.QtCore import * -# from PyQt4.QtXml import * -# from config import global_config - -__license__ = "GPLv3" -__author__ = "Sören Gebbert" -__copyright__ = ( - "Copyright 2016-2018, Sören Gebbert and mundialis GmbH & Co. KG" -) -__maintainer__ = "Sören Gebbert" -__email__ = "soerengebbert@googlemail.com" - - -class GrassModuleReader(object): - """ - Class to parse the module_items.xml file from GRASS - - This class creates a nested module dictionary based on keywords. - The keyword depth is 2, if the second keyword is missing, the - keyword "unspecific" is used as default. - """ - - def __init__(self, filename): - self.modules_keyword_dict = {} - - file = QFile(filename) - file.open(QIODevice.ReadOnly) - self.xml = QXmlStreamReader(file) - - while not self.xml.atEnd(): - self.xml.readNext() - if self.xml.isStartElement(): - if self.xml.name() == "module-item": - name = self.xml.attributes().value("name") - if name: - self.parse_module() - - def get(self): - """ - Return the keyword dictionary - :return: - """ - return self.modules_keyword_dict - - def parse_module(self): - module = None - keywords = None - description = None - - while self.xml.readNextStartElement(): - if self.xml.name() == "module": - module = self.xml.readElementText() - elif self.xml.name() == "description": - description = self.xml.readElementText() - elif self.xml.name() == "keywords": - keywords = self.xml.readElementText() - - if module and keywords and description: - if module in global_config.MODULE_ALLOW_LIST: - # First and second keyword must exist - key_list = str(keywords).split(",") - first_key = key_list[0] - second_key = "unspecific" - if len(key_list) > 1: - second_key = key_list[1] - - if first_key not in self.modules_keyword_dict: - self.modules_keyword_dict[first_key] = {} - if second_key not in self.modules_keyword_dict[first_key]: - self.modules_keyword_dict[first_key][second_key] = {} - - module_entry = self.modules_keyword_dict[first_key][second_key] - module_entry[str(module)] = {} - module_entry[str(module)]["module"] = str(module) - module_entry[str(module)]["description"] = str(description) - module_entry[str(module)]["keywords"] = str(keywords) - - -def test(): - url = global_config.GRASS_MODULES_XML_PATH - xml = GrassModuleReader(url) - - for first_key in xml.modules_keyword_dict: - print(first_key) - level_one = xml.modules_keyword_dict[first_key] - for second_key in level_one: - print(" " + second_key) - level_two = level_one[second_key] - for module in level_two: - entry = level_two[module] - print(" " + entry["module"]) - print(" " + entry["description"]) - - -def main(): - grass_modules_xml_path = global_config.GRASS_MODULES_XML_PATH - module_reader = GrassModuleReader(grass_modules_xml_path) - - file = open("grass_modules_list.py", "w") - file.write("module_list=") - file.write(str(module_reader.get())) - file.close() - - -if __name__ == "__main__": - test() - main() diff --git a/src/actinia_core/core/resources_logger.py b/src/actinia_core/core/resources_logger.py index 09b0b442f..1e86a3403 100644 --- a/src/actinia_core/core/resources_logger.py +++ b/src/actinia_core/core/resources_logger.py @@ -110,7 +110,7 @@ def commit( user_id, resource_id, iteration ) redis_return = bool(self.db.set(db_resource_id, document, expiration)) - http_code, data = pickle.loads(document) + _, data = pickle.loads(document) data["logger"] = "resources_logger" self.send_to_logger("RESOURCE_LOG", data) return redis_return @@ -232,7 +232,7 @@ def get_user_resources(self, user_id): if resource_list_pickled: for entry in resource_list_pickled: - http_code, data = pickle.loads(entry) + _, data = pickle.loads(entry) resource_list.append(data) return resource_list @@ -251,7 +251,7 @@ def get_all_resources(self): if resource_list_pickled: for entry in resource_list_pickled: - http_code, data = pickle.loads(entry) + _, data = pickle.loads(entry) resource_list.append(data) return resource_list diff --git a/src/actinia_core/core/stac_exporter_interface.py b/src/actinia_core/core/stac_exporter_interface.py index daec49ad6..b67147ea2 100644 --- a/src/actinia_core/core/stac_exporter_interface.py +++ b/src/actinia_core/core/stac_exporter_interface.py @@ -277,7 +277,7 @@ def _set_processing_extention(item): def _set_raster_extention(raster_path, item): with rasterio.open(raster_path) as raster: band = raster.read(1) - pixelSizeX, pixelSizeY = raster.res + pixelSizeX, _ = raster.res nodata = np.count_nonzero(np.isnan(band)) spatial_resolution = pixelSizeX diff --git a/src/actinia_core/main.py b/src/actinia_core/main.py index d45556cae..d7395ff54 100644 --- a/src/actinia_core/main.py +++ b/src/actinia_core/main.py @@ -28,8 +28,7 @@ import os from .endpoints import create_endpoints -from .health_check import health_check -from .version import version, init_versions +from .version import init_versions from actinia_core.core.common.app import flask_app from actinia_core.core.common.config import global_config, DEFAULT_CONFIG_PATH from actinia_core.core.common.redis_interface import connect diff --git a/src/actinia_core/processing/actinia_processing/ephemeral/ephemeral_processing_with_export.py b/src/actinia_core/processing/actinia_processing/ephemeral/ephemeral_processing_with_export.py index 205a0aabb..4aa8e55e5 100644 --- a/src/actinia_core/processing/actinia_processing/ephemeral/ephemeral_processing_with_export.py +++ b/src/actinia_core/processing/actinia_processing/ephemeral/ephemeral_processing_with_export.py @@ -440,7 +440,7 @@ def _export_resources(self, use_raster_region=False): resource["export"]["format"], ) self._send_resource_update(message) - output_name, output_path = self._export_raster( + _, output_path = self._export_raster( raster_name=file_name, format=resource["export"]["format"], use_raster_region=use_raster_region, @@ -470,14 +470,14 @@ def _export_resources(self, use_raster_region=False): resource["export"]["format"], ) self._send_resource_update(message) - output_name, output_path = self._export_vector( + _, output_path = self._export_vector( vector_name=file_name, format=resource["export"]["format"], ) elif output_type == "file": file_name = resource["file_name"] tmp_file = resource["tmp_file"] - output_name, output_path = self._export_file( + _, output_path = self._export_file( tmp_file=tmp_file, file_name=file_name ) elif output_type == "strds": @@ -486,7 +486,7 @@ def _export_resources(self, use_raster_region=False): resource["export"]["format"], ) self._send_resource_update(message) - output_name, output_path = self._export_strds( + _, output_path = self._export_strds( strds_name=file_name, format=resource["export"]["format"], ) diff --git a/src/actinia_core/processing/actinia_processing/ephemeral_processing.py b/src/actinia_core/processing/actinia_processing/ephemeral_processing.py index 705d3f8c2..6344e5429 100644 --- a/src/actinia_core/processing/actinia_processing/ephemeral_processing.py +++ b/src/actinia_core/processing/actinia_processing/ephemeral_processing.py @@ -138,7 +138,8 @@ def __init__(self, rdc): try: from fluent import sender - self.has_fluent = True + if sender: + self.has_fluent = True except Exception: self.has_fluent = False @@ -507,7 +508,7 @@ def _post_to_webhook(self, document, type): webhook_retries = 1 webhook_sleep = 0 - http_code, response_model = pickle.loads(document) + _, response_model = pickle.loads(document) webhook_not_reached = True retry = 0 @@ -1238,7 +1239,7 @@ def _check_pixellimit_rimport(self, process_executable_params): # if extent=region set, vrt only for region, not complete input if extent_region: # first query region extents - errorid, stdout_gregion, stderr_gregion = self.ginit.run_module( + errorid, stdout_gregion, _ = self.ginit.run_module( "g.region", ["-ug"] ) if errorid != 0: @@ -1258,13 +1259,13 @@ def _check_pixellimit_rimport(self, process_executable_params): # build vrt with previous defined parameters ( errorid, - stdout_gdalbuildvrt, - stderr_gdalbuildvrt, + _, + _, ) = self.ginit.run_module("/usr/bin/gdalbuildvrt", gdabuildvrt_params) # gdalinfo for created vrt gdalinfo_params = [vrt_out] - errorid, stdout_gdalinfo, stderr_gdalinfo = self.ginit.run_module( + errorid, stdout_gdalinfo, _ = self.ginit.run_module( "/usr/bin/gdalinfo", gdalinfo_params ) # parse "Size" output of gdalinfo @@ -1284,7 +1285,7 @@ def _check_pixellimit_rimport(self, process_executable_params): # If raster exceeds cell limit already in original resolution, next part can be skipped if rimport_res and (rastersize < self.cell_limit): # determine estimated resolution - errorid, stdout_estres, stderr_estres = self.ginit.run_module( + errorid, _, stderr_estres = self.ginit.run_module( "r.import", [vrt_out, "-e"] ) if "Estimated" in stderr_estres: @@ -1320,7 +1321,7 @@ def _check_pixellimit_rimport(self, process_executable_params): ( errorid, stdout_gregion, - stderr_gregion, + _, ) = self.ginit.run_module("g.region", ["-ug"]) res_val_ns = float( [x for x in stdout_gregion.split("\n") if "nsres=" in x][ @@ -1366,9 +1367,7 @@ def _check_reset_region(self): if self.skip_region_check is True: return - errorid, stdout_buff, stderr_buff = self.ginit.run_module( - "g.region", ["-ug"] - ) + errorid, stdout_buff, _ = self.ginit.run_module("g.region", ["-ug"]) if errorid != 0: raise AsyncProcessError( @@ -1690,7 +1689,7 @@ def _run_executable(self, process, poll_time=0.005): for i in range(len(process.executable_params)): param = process.executable_params[i] if func_name in param: - par, val = param.split("=", 1) + _, val = param.split("=", 1) par_val = func().strip() val_splitted = val.split(func_name) for j in range(1, len(val_splitted)): diff --git a/src/actinia_core/processing/actinia_processing/persistent/map_layer_management.py b/src/actinia_core/processing/actinia_processing/persistent/map_layer_management.py index 93ab9b265..8b1e381ac 100644 --- a/src/actinia_core/processing/actinia_processing/persistent/map_layer_management.py +++ b/src/actinia_core/processing/actinia_processing/persistent/map_layer_management.py @@ -137,7 +137,7 @@ def __init__(self, *args): def _execute(self): self._setup() - args, layer_type = self.data + _, layer_type = self.data self.required_mapsets.append(self.target_mapset_name) # List format must be diff --git a/src/actinia_core/rest/process_chain_monitoring.py b/src/actinia_core/rest/process_chain_monitoring.py index aec74fa67..76c941196 100644 --- a/src/actinia_core/rest/process_chain_monitoring.py +++ b/src/actinia_core/rest/process_chain_monitoring.py @@ -288,7 +288,7 @@ def get(self, user_id, resource_id): response_data = self.resource_logger.get(user_id, resource_id) if response_data is not None: - http_code, pc_response_model = pickle.loads(response_data) + _, pc_response_model = pickle.loads(response_data) pc_status = pc_response_model["status"] if pc_status in ["accepted", "running"]: @@ -369,7 +369,7 @@ def get(self, user_id, resource_id): response_data = self.resource_logger.get(user_id, resource_id) if response_data is not None: - http_code, pc_response_model = pickle.loads(response_data) + _, pc_response_model = pickle.loads(response_data) pc_status = pc_response_model["status"] if pc_status in ["accepted", "running"]: diff --git a/src/actinia_core/testsuite.py b/src/actinia_core/testsuite.py index 6dbefb7e6..e8d2de49d 100644 --- a/src/actinia_core/testsuite.py +++ b/src/actinia_core/testsuite.py @@ -34,8 +34,8 @@ from werkzeug.datastructures import Headers from actinia_api import URL_PREFIX +from .version import init_versions from .health_check import health_check -from .version import version, init_versions from actinia_core.core.common.app import flask_app from actinia_core.core.common import redis_interface from actinia_core.core.common.config import global_config @@ -141,6 +141,7 @@ class ActiniaTestCaseBase(unittest.TestCase): # set project_url_part to "locations" if GRASS GIS version < 8.4 init_versions() + health_check = health_check from .version import G_VERSION grass_version_s = G_VERSION["version"] diff --git a/tests/test_async_processing_import_export.py b/tests/test_async_processing_import_export.py index 559d00ced..9e9607915 100644 --- a/tests/test_async_processing_import_export.py +++ b/tests/test_async_processing_import_export.py @@ -44,7 +44,8 @@ try: import actinia_stac_plugin - no_stac_plugin = False + if actinia_stac_plugin: + no_stac_plugin = False except Exception: no_stac_plugin = True diff --git a/tests/test_noauth.py b/tests/test_noauth.py index b03e4d9ae..9331741ef 100644 --- a/tests/test_noauth.py +++ b/tests/test_noauth.py @@ -33,11 +33,12 @@ from actinia_core.core.common.config import global_config from actinia_core.core.common import redis_interface from actinia_core.core.common.process_queue import create_process_queue -from actinia_core.testsuite import ( - ActiniaRequests, - ActiniaTestCaseBase, - URL_PREFIX, -) +from actinia_core.testsuite import ActiniaRequests + +try: + from .test_resource_base import ActiniaResourceTestCaseBase, URL_PREFIX +except Exception: + from test_resource_base import ActiniaResourceTestCaseBase, URL_PREFIX __license__ = "GPLv3" __author__ = "Anika Weinmann" @@ -92,7 +93,7 @@ } -class ActiniaWithoutAuthentication(ActiniaTestCaseBase): +class ActiniaWithoutAuthentication(ActiniaResourceTestCaseBase): """Test base class to test actinia without autentication""" server_test = False diff --git a/tests/test_process_queue.py b/tests/test_process_queue.py index 0f704d06f..f0fdfbbfc 100644 --- a/tests/test_process_queue.py +++ b/tests/test_process_queue.py @@ -41,6 +41,8 @@ except ModuleNotFoundError: from test_resource_base import global_config +global_config = global_config + __license__ = "GPLv3" __author__ = "Sören Gebbert, Anika Weinmann" __copyright__ = ( diff --git a/tests/test_resource_base.py b/tests/test_resource_base.py index 0f7befb7a..c2aee05ee 100644 --- a/tests/test_resource_base.py +++ b/tests/test_resource_base.py @@ -103,6 +103,8 @@ def stop_redis(): # Setup the environment setup_environment() +URL_PREFIX = URL_PREFIX + class ActiniaResourceTestCaseBase(ActiniaTestCaseBase): pass diff --git a/tests/unittests/test_sentinel2_processing_commands.py b/tests/unittests/test_sentinel2_processing_commands.py index af509b92e..31c62184e 100644 --- a/tests/unittests/test_sentinel2_processing_commands.py +++ b/tests/unittests/test_sentinel2_processing_commands.py @@ -91,7 +91,7 @@ def test_download_import_commands(self): message_logger=MessageDummy(), ) # download commands - result, maps = gsqi.get_sentinel2_download_process_list() + result, _ = gsqi.get_sentinel2_download_process_list() print(len(result)) for p in result: print(str(p))