diff --git a/src/run_modules/pre_processing.py b/src/run_modules/pre_processing.py index ee764174a86ef1c72e5f13d0db66502eda5d72a2..1f84db143130357e8b3b044bcb5aacc345a9c0f6 100644 --- a/src/run_modules/pre_processing.py +++ b/src/run_modules/pre_processing.py @@ -125,11 +125,12 @@ class PreProcessing(RunEnvironment): :param kwargs: positional parameters for the DataGenerator class (e.g. `start`, `interpolate_method`, `window_lead_time`). :param all_stations: All stations to check. + :param name: name to display in the logging info message :return: Corrected list containing only valid station IDs. """ t_outer = TimeTracking() t_inner = TimeTracking(start=False) - logging.info(f"check valid stations started{' (%s)' % name if name else name}") + logging.info(f"check valid stations started{' (%s)' % name if name else ''}") valid_stations = [] # all required arguments of the DataGenerator can be found in args, positional arguments in args and kwargs diff --git a/test/test_modules/test_pre_processing.py b/test/test_modules/test_pre_processing.py index d58cbd41e2ce4f25f4cd79127256e313b4aac649..7fbf202dc25b605107706d19bb3dd309cb567f9c 100644 --- a/test/test_modules/test_pre_processing.py +++ b/test/test_modules/test_pre_processing.py @@ -81,16 +81,18 @@ class TestPreProcessing: data_store.get("generator", "general") assert data_store.get("stations", "general.awesome") == ['DEBW107', 'DEBY081', 'DEBW013', 'DEBW076', 'DEBW087'] - def test_check_valid_stations(self, caplog, obj_with_exp_setup): + @pytest.mark.parametrize("name", (None, "tester")) + def test_check_valid_stations(self, caplog, obj_with_exp_setup, name): pre = obj_with_exp_setup caplog.set_level(logging.INFO) args = pre.data_store.create_args_dict(DEFAULT_ARGS_LIST) kwargs = pre.data_store.create_args_dict(DEFAULT_KWARGS_LIST) stations = pre.data_store.get("stations", "general") - valid_stations = pre.check_valid_stations(args, kwargs, stations) + valid_stations = pre.check_valid_stations(args, kwargs, stations, name=name) assert len(valid_stations) < len(stations) assert valid_stations == stations[:-1] - assert caplog.record_tuples[0] == ('root', 20, 'check valid stations started') + expected = 'check valid stations started (tester)' if name else 'check valid stations started' + assert caplog.record_tuples[0] == ('root', 20, expected) assert caplog.record_tuples[-1] == ('root', 20, PyTestRegex(r'run for \d+:\d+:\d+ \(hh:mm:ss\) to check 6 ' r'station\(s\). Found 5/6 valid stations.'))