Skip to content

Commit 533d63c

Browse files
committed
Add warning about comments not being converted
1 parent f741e3f commit 533d63c

4 files changed

Lines changed: 13 additions & 2 deletions

File tree

ymmsl/conversion/convert_v0_1_to_v0_2.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ def convert_v0_1_to_v0_2(config: v0_1.PartialConfiguration) -> v0_2.Configuratio
3434
checkpoints = deepcopy(config.checkpoints)
3535
resume = deepcopy(config.resume)
3636

37+
warnings.warn(
38+
'Comments can unfortunately not be read by this converter, and so have been'
39+
' ignored. Please copy them into an appropriate description field.')
40+
3741
return v0_2.Configuration(
3842
description, None, models, None, settings, programs, resources, checkpoints,
3943
resume)

ymmsl/conversion/tests/test_convert_v0_1_to_v0_2.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
Ref2 = v0_2.Reference
1515

1616

17+
@pytest.mark.filterwarnings('ignore:Comments.*')
1718
def test_convert_simple_config(empty_config: v0_1.PartialConfiguration) -> None:
1819
v2 = convert_v0_1_to_v0_2(empty_config)
20+
1921
assert v2.description == 'Please add a description'
2022
assert isinstance(v2.settings, v0_2.Settings)
2123
assert len(v2.settings) == 0
@@ -27,9 +29,10 @@ def test_convert_simple_config(empty_config: v0_1.PartialConfiguration) -> None:
2729
assert v2.resume == {}
2830

2931

32+
@pytest.mark.filterwarnings('ignore:Comments.*')
33+
@pytest.mark.filterwarnings('ignore:.*implementations have become programs.*')
3034
def test_convert_full_config(full_config: v0_1.Configuration) -> None:
31-
with pytest.warns(UserWarning):
32-
v2 = convert_v0_1_to_v0_2(full_config)
35+
v2 = convert_v0_1_to_v0_2(full_config)
3336
assert v2.description == 'Testing a full configuration'
3437

3538
assert v2.settings is not full_config.settings

ymmsl/conversion/tests/test_converter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def test_convert_to_no_change(full_config: v0_1.PartialConfiguration) -> None:
1414

1515

1616
@pytest.mark.filterwarnings('ignore:.*specify the ports.*')
17+
@pytest.mark.filterwarnings('ignore:Comments.*')
1718
def test_convert_to(full_config: v0_1.PartialConfiguration) -> None:
1819
new_config = convert_to(v0_2.Configuration, full_config)
1920
assert isinstance(new_config, v0_2.Configuration)

ymmsl/tests/test_load_as.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@
44
import ymmsl.v0_1 as v0_1
55
import ymmsl.v0_2 as v0_2
66

7+
import pytest
8+
79

810
def test_load_as_v0_1(test_yaml1: str) -> None:
911
config = load_as(v0_1.PartialConfiguration, test_yaml1)
1012
assert isinstance(config, v0_1.PartialConfiguration)
1113
assert cast(List[int], config.settings['test_list'])[0] == 12.3
1214

1315

16+
@pytest.mark.filterwarnings('ignore:Comments.*')
1417
def test_load_as_v0_2(test_yaml1: str) -> None:
1518
config = load_as(v0_2.Configuration, test_yaml1)
1619
assert isinstance(config, v0_2.Configuration)

0 commit comments

Comments
 (0)