Closed Bug 1675925 Opened 4 years ago Closed 4 years ago

Fix deprecation warning in testing/raptor/test/test_utils.py

Categories

(Testing :: Raptor, task, P3)

Default
task

Tracking

(firefox84 fixed)

RESOLVED FIXED
84 Branch
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.

Severity: -- → S3
Priority: -- → P3

Hi Andrey, it would be much appreciated if you could make a patch for this! :)

Assignee: nobody → hexagonrecursion
Attachment #9186461 - Attachment description: Bug 1675925 - [reptor] Fix deprecation warning in testing/raptor/test/test_utils.py r=sparky → Bug 1675925 - [raptor] Fix deprecation warning in testing/raptor/test/test_utils.py. r=sparky
Pushed by gmierz2@outlook.com: https://hg.mozilla.org/integration/autoland/rev/b31db4ca587a [raptor] Fix deprecation warning in testing/raptor/test/test_utils.py. r=sparky,perftest-reviewers
Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 84 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: