-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_collect.py
103 lines (96 loc) · 2.38 KB
/
test_collect.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
from __future__ import annotations
from contextlib import ExitStack as does_not_raise # noqa: N813
import pytest
from pytask import Mark
from pytask_julia.collect import SERIALIZERS
from pytask_julia.collect import _parse_julia_mark
from pytask_julia.collect import _parse_project
from tests.conftest import ROOT
@pytest.mark.unit
@pytest.mark.parametrize(
(
"mark",
"default_options",
"default_serializer",
"default_suffix",
"default_project",
"expectation",
"expected",
),
[
(
Mark("julia", (), {"script": "script.jl"}),
[],
None,
".json",
"some_path",
does_not_raise(),
Mark(
"julia",
(),
{
"script": "script.jl",
"options": [],
"serializer": None,
"suffix": ".json",
"project": "some_path",
},
),
),
(
Mark(
"julia",
(),
{
"script": "script.jl",
"serializer": "json",
"project": "some_path",
},
),
[],
None,
None,
"some_other_path",
does_not_raise(),
Mark(
"julia",
(),
{
"script": "script.jl",
"options": [],
"serializer": "json",
"suffix": SERIALIZERS["json"]["suffix"],
"project": "some_path",
},
),
),
],
)
def test_parse_julia_mark( # noqa: PLR0913
mark,
default_options,
default_serializer,
default_suffix,
default_project,
expectation,
expected,
):
with expectation:
out = _parse_julia_mark(
mark,
default_options,
default_serializer,
default_suffix,
default_project,
)
assert out == expected
@pytest.mark.unit
@pytest.mark.parametrize(
("project", "root", "expected"),
[
(None, ROOT, []),
],
)
def test_parse_project(project, root, expected):
result = _parse_project(project, root)
assert result == expected