mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 12:32:08 +02:00
MDL-66004 mlbackend_python: Purge testing output dirs properly
This commit is contained in:
parent
aab2b2103e
commit
63c15f6c58
@ -54,6 +54,23 @@ require_once(__DIR__ . '/../../course/lib.php');
|
||||
*/
|
||||
class core_analytics_prediction_testcase extends advanced_testcase {
|
||||
|
||||
/**
|
||||
* Purge all the mlbackend outputs.
|
||||
*
|
||||
* This is done automatically for mlbackends using the web server dataroot but
|
||||
* other mlbackends may store files elsewhere and these files need to be removed.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function tearDown() {
|
||||
$this->setAdminUser();
|
||||
|
||||
$models = \core_analytics\manager::get_all_models();
|
||||
foreach ($models as $model) {
|
||||
$model->delete();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* test_static_prediction
|
||||
*
|
||||
@ -414,7 +431,8 @@ class core_analytics_prediction_testcase extends advanced_testcase {
|
||||
|
||||
// Training should work correctly if at least 1 sample of each class is included.
|
||||
$dir = make_request_directory();
|
||||
$result = $predictionsprocessor->train_classification('whatever' . microtime(), $dataset, $dir);
|
||||
$modeluniqueid = 'whatever' . microtime();
|
||||
$result = $predictionsprocessor->train_classification($modeluniqueid, $dataset, $dir);
|
||||
|
||||
switch ($success) {
|
||||
case 'yes':
|
||||
@ -429,6 +447,10 @@ class core_analytics_prediction_testcase extends advanced_testcase {
|
||||
// what we really want to check is that an exception was not thrown.
|
||||
$this->assertInstanceOf(\stdClass::class, $result);
|
||||
}
|
||||
|
||||
// Purge the directory used in this test (useful in case the mlbackend is storing files
|
||||
// somewhere out of the default moodledata/models dir.
|
||||
$predictionsprocessor->delete_output_dir($dir, $modeluniqueid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -38,7 +38,7 @@ class processor implements \core_analytics\classifier, \core_analytics\regresso
|
||||
/**
|
||||
* The required version of the python package that performs all calculations.
|
||||
*/
|
||||
const REQUIRED_PIP_PACKAGE_VERSION = '2.2.0';
|
||||
const REQUIRED_PIP_PACKAGE_VERSION = '2.2.1';
|
||||
|
||||
/**
|
||||
* The python package is installed in a server.
|
||||
|
Loading…
x
Reference in New Issue
Block a user