From 1dd848a53e7191914e3ebaabceb07ba66070bd35 Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Thu, 27 Jan 2022 11:13:56 +0100 Subject: Don't report an error when parsing an empty annotations file Fixes: #64 --- tests/in/empty_tuner_annotations.yaml | 0 tests/test_tags.py | 10 ++++++++++ 2 files changed, 10 insertions(+) create mode 100644 tests/in/empty_tuner_annotations.yaml (limited to 'tests') diff --git a/tests/in/empty_tuner_annotations.yaml b/tests/in/empty_tuner_annotations.yaml new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_tags.py b/tests/test_tags.py index 0e70143..be9483c 100644 --- a/tests/test_tags.py +++ b/tests/test_tags.py @@ -68,6 +68,16 @@ def test_merge_annotation(): FileSystem.merge_annotations(system, inputPath / 'tuner_annotations.yaml') assert interface.attribute('extra', 'extraA') is True +@patch('sys.stderr', new_callable=StringIO) +def test_merge_empty_annotation(mock_stderr): + system = loadTuner() + interface = system.lookup('com.pelagicore.ivi.tuner.Tuner') + assert interface + FileSystem.merge_annotations(system, inputPath / 'empty_tuner_annotations.yaml') + + assert interface.attribute('extra', 'extraA') is None + assert not mock_stderr.getvalue().__contains__("Error parsing annotation") + @patch('sys.stderr', new_callable=StringIO) def test_merge_broken_annotation(mock_stderr): system = loadTuner() -- cgit v1.2.3