Fix deprecation warning in testing/raptor/test/test_utils.py
Categories
(Testing :: Raptor, task, P3)
Tracking
(firefox84 fixed)
Tracking | Status | |
---|---|---|
firefox84 | --- | fixed |
People
(Reporter: hexagonrecursion, Assigned: hexagonrecursion)
Details
Attachments
(1 file)
testing/raptor/test/test_utils.py::test_write_yml_file uses yaml.load() which was deprecated in pyyaml https://msg.pyyaml.org/load
The code under test writes a .yaml file into a temporary directory and then the test reads it back using yaml.load() and checks the contents.
Usually the fix for this warning is to replace yaml.load() with yaml.safe_load(), but in this case the file written by the code under test uses !!python/unicode
(see below) and yaml.safe_load() can not interpret that.
args:
- !!python/unicode '--a'
- !!python/unicode 'apple'
- !!python/unicode '--b'
- !!python/unicode 'banana'
env:
LOG_VERBOSE: 1
I think it is safe to use yaml.unsafe_load() here because yaml file should only contain data produced by the unit test. A better fix might be to make the code under test stop using !!python/unicode
which should make the resulting yaml safer and more portale, but I'm not sure how to do that. I'll attach a patch soon.
Updated•4 years ago
|
Comment 1•4 years ago
|
||
Hi Andrey, it would be much appreciated if you could make a patch for this! :)
Assignee | ||
Comment 2•4 years ago
|
||
Updated•4 years ago
|
Updated•4 years ago
|
Comment 4•4 years ago
|
||
bugherder |
Description
•