From 463b63db2a88af73d57b19b15fc1bec960c3e115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Monlla=C3=B3?= Date: Tue, 1 Oct 2019 07:08:50 +0800 Subject: [PATCH] MDL-66004 analytics: mlbackend_python tested just once Either running locally from the web server or using a server if TEST_MLBACKEND_* vars are set. The tests will still be skipped if the python backend is not available in the web server. --- analytics/tests/prediction_test.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/analytics/tests/prediction_test.php b/analytics/tests/prediction_test.php index 8f8bca1da0f..b0471f2ef8e 100644 --- a/analytics/tests/prediction_test.php +++ b/analytics/tests/prediction_test.php @@ -900,15 +900,12 @@ class core_analytics_prediction_testcase extends advanced_testcase { // We need to test all prediction processors in the system. $predictionprocessors = \core_analytics\manager::get_all_prediction_processors(); foreach ($predictionprocessors as $classfullname => $predictionsprocessor) { - foreach ($cases as $key => $case) { - $return[$key . '-' . $classfullname] = $case + ['predictionsprocessor' => $classfullname, 'forcedconfig' => null]; - } - if ($predictionsprocessor instanceof \mlbackend_python\processor && !empty($testpythonserver)) { - // We also want to test the python processor using the server. - - foreach ($cases as $key => $case) { + if (!$predictionsprocessor instanceof \mlbackend_python\processor || empty($testpythonserver)) { + $extraparams = ['predictionsprocessor' => $classfullname, 'forcedconfig' => null]; + $return[$key . '-' . $classfullname] = $case + $extraparams; + } else { // We want the configuration to be forced during the test as things like importing models create new // instances of ML backend processors during the process.