support/testing/../sample_python_pyyaml_dec.py: unbreak after move to pyaml 6.0

Fixes https://gitlab.com/buildroot.org/buildroot/-/jobs/2088684091

python sample_python_pyyaml_dec.py
Traceback (most recent call last):
  File "/root/sample_python_pyyaml_dec.py", line 5, in <module>
    data = yaml.load(serialized)
TypeError: load() missing 1 required positional argument: 'Loader'

yaml.load() requires a loader argument since the move to version 6.0:
https://github.com/yaml/pyyaml/pull/561

The test does not need the extra functionality of load(), so instead move to
the recommended safe_load().

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Tested-by: Romain Naour <romain.naour@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Peter Korsgaard 2022-02-20 22:10:54 +01:00
parent f3d0d7e6ff
commit a83177aac6

View File

@ -2,7 +2,7 @@ import yaml
with open("/tmp/data.yml", "rb") as f:
serialized = f.read()
data = yaml.load(serialized)
data = yaml.safe_load(serialized)
print(data)
assert(data["name"] == "python-pyyaml")
assert(data["versions"] == ["1", "2"])