prepare-assignment 0.4.3__tar.gz → 0.4.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/PKG-INFO +1 -1
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/core/task_handler.py +2 -2
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/data/task_properties.py +22 -13
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/utils/tasks.py +2 -2
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/pyproject.toml +1 -1
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/core/test_task_handler.py +11 -0
- prepare_assignment-0.4.4/tests/data/test_task_properties.py +45 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/.github/dependabot.yml +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/.github/workflows/pr-title.yml +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/.github/workflows/pypi-publish.yml +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/.github/workflows/release.yml +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/.github/workflows/semantic-release.yml +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/.github/workflows/test.yml +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/.gitignore +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/.releaserc.json +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/LICENSE +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/README.md +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/__init__.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/__main__.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/cli/__init__.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/cli/main.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/cli/task.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/cli/tasks.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/core/__init__.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/core/check.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/core/command.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/core/expression.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/core/main.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/core/preparer.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/core/runner.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/core/shell.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/core/subsituter.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/core/validator.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/core/versions.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/data/__init__.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/data/config.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/data/constants.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/data/errors.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/data/job_environment.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/data/prepare.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/data/task_definition.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/data/types.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/schemas/config.schema.json +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/schemas/prepare.schema.json +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/schemas/task.schema.json +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/utils/__init__.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/utils/config.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/utils/default_validator.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/utils/dependency.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/utils/files.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/utils/logger.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/utils/paths.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/utils/resources.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/utils/virtual_env.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/utils/yml_loader.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/__init__.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/conftest.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/core/__init__.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/core/test_check.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/core/test_command.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/core/test_expression.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/core/test_preparer.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/core/test_resolve_version.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/core/test_runner.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/core/test_runner_process.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/core/test_shell.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/core/test_substituter.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/core/test_validator.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/data/__init__.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/data/test_prepare.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/data/test_types.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/test_dependencies.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/test_main.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/testproject/prepare.yml +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/testproject/solution/pom.xml +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/testproject/solution/src/main/java/gradelist/AssessmentResult.java +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/testproject/solution/src/main/java/gradelist/GradeList.java +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/testproject/solution/src/main/java/gradelist/Test.java +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/testproject/solution/src/test/java/gradelist/AssessmentResultTest.java +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/testproject/solution/src/test/java/gradelist/GradeListTest.java +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/utils/__init__.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/utils/test_config.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/utils/test_default_validator.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/utils/test_files.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/utils/test_logger.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/utils/test_paths.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/tests/utils/test_resources.py +0 -0
- {prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/uv.lock +0 -0
{prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/core/task_handler.py
RENAMED
|
@@ -9,7 +9,7 @@ from treelib import Tree
|
|
|
9
9
|
from prepare_assignment.core.preparer import __prepare_tasks
|
|
10
10
|
from prepare_assignment.core.versions import get_git_url, is_fixed_version
|
|
11
11
|
from prepare_assignment.data.task_definition import TaskDefinition
|
|
12
|
-
from prepare_assignment.data.task_properties import TaskProperties
|
|
12
|
+
from prepare_assignment.data.task_properties import TaskProperties, directory_to_version
|
|
13
13
|
from prepare_assignment.utils.files import remove_tree
|
|
14
14
|
from prepare_assignment.utils.dependency import get_dependencies
|
|
15
15
|
from prepare_assignment.utils.paths import get_tasks_path
|
|
@@ -88,7 +88,7 @@ def ls() -> None:
|
|
|
88
88
|
version_path = os.path.join(org_path, task)
|
|
89
89
|
versions = sorted(os.listdir(version_path))
|
|
90
90
|
for version in versions:
|
|
91
|
-
tree.create_node(version, parent=task)
|
|
91
|
+
tree.create_node(directory_to_version(version), parent=task)
|
|
92
92
|
t = tree.show(stdout=False)
|
|
93
93
|
print(t)
|
|
94
94
|
|
{prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/data/task_properties.py
RENAMED
|
@@ -18,7 +18,14 @@ class TaskProperties:
|
|
|
18
18
|
|
|
19
19
|
@cached_property
|
|
20
20
|
def task_path(self) -> Path:
|
|
21
|
-
return Path(os.path.join(tasks_path, self.organization, self.name, self.
|
|
21
|
+
return Path(os.path.join(tasks_path, self.organization, self.name, self.version_directory))
|
|
22
|
+
|
|
23
|
+
@property
|
|
24
|
+
def version_directory(self) -> str:
|
|
25
|
+
"""
|
|
26
|
+
The version as a single directory name, a branch can contain a slash (e.g. fix/something)
|
|
27
|
+
"""
|
|
28
|
+
return version_to_directory(self.version)
|
|
22
29
|
|
|
23
30
|
@cached_property
|
|
24
31
|
def repo_path(self) -> Path:
|
|
@@ -38,19 +45,21 @@ class TaskProperties:
|
|
|
38
45
|
|
|
39
46
|
@classmethod
|
|
40
47
|
def of(cls, task: str) -> TaskProperties:
|
|
41
|
-
|
|
48
|
+
# Everything after the first '@' is the version, a branch can contain a slash
|
|
49
|
+
name, separator, version = task.partition("@")
|
|
50
|
+
if not separator:
|
|
51
|
+
version = "latest"
|
|
52
|
+
parts = name.split("/")
|
|
42
53
|
if len(parts) > 2:
|
|
43
54
|
raise ValueError("Tasks cannot have more than one slash")
|
|
44
55
|
elif len(parts) == 1:
|
|
45
56
|
parts.insert(0, "prepare-assignment")
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
version = split[1]
|
|
56
|
-
return cls(organization, task_name, version)
|
|
57
|
+
return cls(parts[0], parts[1], version)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def version_to_directory(version: str) -> str:
|
|
61
|
+
return version.replace("%", "%25").replace("/", "%2F")
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def directory_to_version(directory: str) -> str:
|
|
65
|
+
return directory.replace("%2F", "/").replace("%25", "%")
|
|
@@ -2,7 +2,7 @@ import os
|
|
|
2
2
|
from typing import List
|
|
3
3
|
|
|
4
4
|
from prepare_assignment.data.task_definition import TaskDefinition
|
|
5
|
-
from prepare_assignment.data.task_properties import TaskProperties
|
|
5
|
+
from prepare_assignment.data.task_properties import TaskProperties, directory_to_version
|
|
6
6
|
from prepare_assignment.utils.paths import get_tasks_path
|
|
7
7
|
from prepare_assignment.utils.yml_loader import YAML_LOADER
|
|
8
8
|
|
|
@@ -20,7 +20,7 @@ def get_all_tasks() -> List[TaskProperties]:
|
|
|
20
20
|
version_path = os.path.join(org_path, task)
|
|
21
21
|
versions = os.listdir(version_path)
|
|
22
22
|
for version in versions:
|
|
23
|
-
tasks.append(TaskProperties
|
|
23
|
+
tasks.append(TaskProperties(org, task, directory_to_version(version)))
|
|
24
24
|
return tasks
|
|
25
25
|
|
|
26
26
|
|
|
@@ -93,3 +93,14 @@ def test_load_task_uses_task_path(tasks_dir: Path) -> None:
|
|
|
93
93
|
props = TaskProperties.of("remove")
|
|
94
94
|
_install_fake(props, "x")
|
|
95
95
|
assert load_task(props).path == props.task_path
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def test_version_with_slash(tasks_dir: Path, mocker: MockerFixture, capsys: pytest.CaptureFixture) -> None:
|
|
99
|
+
from prepare_assignment.utils.tasks import get_all_tasks
|
|
100
|
+
mocker.patch("prepare_assignment.utils.tasks.get_tasks_path", return_value=tasks_dir)
|
|
101
|
+
mocker.patch("prepare_assignment.core.task_handler.tasks_path", tasks_dir)
|
|
102
|
+
props = TaskProperties.of("remove@fix/something")
|
|
103
|
+
_install_fake(props, "branch")
|
|
104
|
+
assert get_all_tasks() == [props]
|
|
105
|
+
task_handler.ls()
|
|
106
|
+
assert "fix/something" in capsys.readouterr().out
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
from prepare_assignment.data.task_properties import TaskProperties, directory_to_version, version_to_directory
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@pytest.mark.parametrize("task, expected", [
|
|
9
|
+
("remove", TaskProperties("prepare-assignment", "remove", "latest")),
|
|
10
|
+
("remove@v1", TaskProperties("prepare-assignment", "remove", "v1")),
|
|
11
|
+
("prepare-assignment/remove", TaskProperties("prepare-assignment", "remove", "latest")),
|
|
12
|
+
("org/remove@v1.0.0", TaskProperties("org", "remove", "v1.0.0")),
|
|
13
|
+
("prc2-assignment@fix/tasks-and-shell", TaskProperties("prepare-assignment", "prc2-assignment",
|
|
14
|
+
"fix/tasks-and-shell")),
|
|
15
|
+
("prepare-assignment/remove@fix/something", TaskProperties("prepare-assignment", "remove", "fix/something")),
|
|
16
|
+
("remove@feat/a@b", TaskProperties("prepare-assignment", "remove", "feat/a@b")),
|
|
17
|
+
])
|
|
18
|
+
def test_of(task: str, expected: TaskProperties) -> None:
|
|
19
|
+
assert TaskProperties.of(task) == expected
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def test_of_more_than_one_slash_in_name() -> None:
|
|
23
|
+
with pytest.raises(ValueError):
|
|
24
|
+
TaskProperties.of("a/b/c@v1")
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def test_str_keeps_slash_in_version() -> None:
|
|
28
|
+
assert str(TaskProperties.of("remove@fix/something")) == "prepare-assignment/remove@fix/something"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def test_task_path_is_single_directory_for_version() -> None:
|
|
32
|
+
props = TaskProperties.of("remove@fix/something")
|
|
33
|
+
assert props.task_path.name == "fix%2Fsomething"
|
|
34
|
+
assert props.task_path.parent.name == "remove"
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def test_task_path_unchanged_for_plain_version() -> None:
|
|
38
|
+
assert TaskProperties.of("remove@v1.0.0").task_path.name == "v1.0.0"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@pytest.mark.parametrize("version", ["v1", "fix/something", "a/b/c", "100%", "%2F", "a%2F/b%25"])
|
|
42
|
+
def test_version_directory_round_trip(version: str) -> None:
|
|
43
|
+
directory = version_to_directory(version)
|
|
44
|
+
assert os.sep not in directory
|
|
45
|
+
assert directory_to_version(directory) == version
|
|
File without changes
|
{prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/.github/ISSUE_TEMPLATE/feature_request.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/.github/workflows/semantic-release.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/data/job_environment.py
RENAMED
|
File without changes
|
|
File without changes
|
{prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/data/task_definition.py
RENAMED
|
File without changes
|
|
File without changes
|
{prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/schemas/config.schema.json
RENAMED
|
File without changes
|
{prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/schemas/prepare.schema.json
RENAMED
|
File without changes
|
{prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/schemas/task.schema.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/utils/default_validator.py
RENAMED
|
File without changes
|
{prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/utils/dependency.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/utils/virtual_env.py
RENAMED
|
File without changes
|
{prepare_assignment-0.4.3 → prepare_assignment-0.4.4}/prepare_assignment/utils/yml_loader.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|