diff --git a/python/protocan/trends.py b/python/protocan/trends.py index 22e2daa..e047e1b 100644 --- a/python/protocan/trends.py +++ b/python/protocan/trends.py @@ -129,7 +129,8 @@ def encode_settings(settings: Mapping[str, list[TrendSignal]]) -> str: def decode_settings(text: str) -> dict[str, list[TrendSignal]]: if len(text.encode("utf-8")) > MAX_FILE_BYTES: raise ValueError("Trend configuration exceeds 1 MiB") - root = json.loads(text.removeprefix("\ufeff")) + # Python 3.8 is used by the Windows 7 port; remove at most one BOM. + root = json.loads(text[1:] if text.startswith("\ufeff") else text) if not isinstance(root, dict) or root.get("format") != "setflash-trends" or type(root.get("version")) is not int or root["version"] != 1: raise ValueError("Unknown trend configuration format/version") profiles = root.get("profiles") diff --git a/python/tests/test_plot.py b/python/tests/test_plot.py index b229824..4470200 100644 --- a/python/tests/test_plot.py +++ b/python/tests/test_plot.py @@ -9,6 +9,7 @@ import unittest from protocan.plot import Bounds, Marker, Markers, PlotMath, Viewport +@unittest.skipUnless(os.environ.get("SETPROTOCOL_LIBRARY"), "Set SETPROTOCOL_LIBRARY to the built C library") class PlotTests(unittest.TestCase): @classmethod def setUpClass(cls):