launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #33084
Re: [Merge] ~ilkeremrekoc/launchpad:add-extra-attrs into launchpad:master
Diff comments:
> diff --git a/lib/lp/bugs/scripts/soss/tests/test_sossexport.py b/lib/lp/bugs/scripts/soss/tests/test_sossexport.py
> index 1752d8e..26b72a6 100644
> --- a/lib/lp/bugs/scripts/soss/tests/test_sossexport.py
> +++ b/lib/lp/bugs/scripts/soss/tests/test_sossexport.py
> @@ -90,6 +90,29 @@ class TestSOSSExporter(TestCaseWithFactory):
> self.soss, information_type=InformationType.PROPRIETARY
> )
>
> + original_to_dict = SOSSRecord.to_dict
> +
> + def mock_to_dict(*args, **kwargs):
> + # Ensure that Extra_attrs is always sorted to avoid test failures
I see. Then why adding this logic here in the test and not in the `to_dict` function to always write ordered.
> + # due to dictionary order differences.
> +
> + result = original_to_dict(*args, **kwargs)
> +
> + if "Extra_attrs" in result:
> + result["Extra_attrs"] = dict(
> + sorted(
> + result["Extra_attrs"].items(), key=lambda item: item[0]
> + )
> + )
> +
> + return result
> +
> + self.patch(
> + SOSSRecord,
> + "to_dict",
> + mock_to_dict,
> + )
> +
> for file in self.sampledata.iterdir():
>
> bug, vulnerability = soss_importer.import_cve_from_file(file)
> diff --git a/lib/lp/bugs/scripts/soss/tests/test_sossimport.py b/lib/lp/bugs/scripts/soss/tests/test_sossimport.py
> index 675da82..6efc532 100644
> --- a/lib/lp/bugs/scripts/soss/tests/test_sossimport.py
> +++ b/lib/lp/bugs/scripts/soss/tests/test_sossimport.py
> @@ -197,7 +204,7 @@ class TestSOSSImporter(TestCaseWithFactory):
>
> self._check_bugtasks(
> bug.bugtasks,
> - self.bugtask_reference,
> + bugtask_reference,
Nice! Thanks!!! <3
> BugTaskImportance.LOW,
> self.janitor,
> )
--
https://code.launchpad.net/~ilkeremrekoc/launchpad/+git/launchpad/+merge/493278
Your team Launchpad code reviewers is requested to review the proposed merge of ~ilkeremrekoc/launchpad:add-extra-attrs into launchpad:master.
References