-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a56c4a4
commit ae34ff6
Showing
5 changed files
with
102 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 8 additions & 2 deletions
10
backend/tests/utils/submission_evaluators/base_evaluators_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
from project.utils.submissions.file_handling import create_submission_folder | ||
""" | ||
This file contains tests for functions that are applicable to all evaluators. | ||
""" | ||
from os import path | ||
from shutil import rmtree | ||
from project.utils.submissions.file_handling import create_submission_folder | ||
|
||
def test_create_submission_folder_creates(submission_root): | ||
""" | ||
Test whether the create_submission_folder function creates the submission folder. | ||
""" | ||
submission_id = 1 | ||
project_id = 1 | ||
submission_path = create_submission_folder(submission_id, project_id) | ||
assert path.join(submission_path) \ | ||
== path.join(submission_root, str(project_id), str(submission_id)) | ||
assert path.exists(submission_path) | ||
assert path.exists(path.join(submission_path, "submission")) | ||
rmtree(submission_path) | ||
rmtree(submission_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
import pytest | ||
""" | ||
This file contains the global fixtures for the submission evaluators tests. | ||
""" | ||
from shutil import rmtree | ||
from os import environ, mkdir, path | ||
import pytest | ||
|
||
@pytest.fixture | ||
def submission_root(): | ||
""" | ||
Create a submission root folder for the tests. | ||
When the tests are done, the folder is removed recursively. | ||
""" | ||
submission_root = path.join(path.dirname(__file__), "submissions-root") | ||
environ["SUBMISSIONS_ROOT_PATH"] = submission_root | ||
mkdir(submission_root) | ||
yield submission_root | ||
rmtree(submission_root) | ||
rmtree(submission_root) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters