6
6
7
7
8
8
@pytest .mark .parametrize ("container_enabled" , [True , False ])
9
+ @pytest .mark .parametrize ("existing_archived" , [True , False , None ])
9
10
@pytest .mark .parametrize ("mark_not_archived" , [True , False ])
10
11
def test_try_load_feedstock (
11
- request : pytest .FixtureRequest , mark_not_archived : bool , container_enabled : bool
12
+ request : pytest .FixtureRequest ,
13
+ mark_not_archived : bool ,
14
+ existing_archived : bool | None ,
15
+ container_enabled : bool ,
12
16
):
13
17
if container_enabled :
14
18
request .getfixturevalue ("use_containers" )
@@ -18,15 +22,18 @@ def test_try_load_feedstock(
18
22
fake_lazy_json = FakeLazyJson () # empty dict
19
23
20
24
with fake_lazy_json as loaded_lazy_json :
25
+ if existing_archived is not None :
26
+ loaded_lazy_json ["archived" ] = existing_archived
21
27
# FakeLazyJson is not an instance of LazyJson
22
28
# noinspection PyTypeChecker
23
29
data = try_load_feedstock (feedstock , loaded_lazy_json , mark_not_archived ).data # type: ignore
24
30
25
31
if mark_not_archived :
26
32
assert data ["archived" ] is False
27
- else :
28
- # apparently, this is how the function behaves
33
+ elif existing_archived is None :
29
34
assert "archived" not in data
35
+ else :
36
+ assert data ["archived" ] is existing_archived
30
37
31
38
assert data ["feedstock_name" ] == feedstock
32
39
assert data ["parsing_error" ] is False
0 commit comments