jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/497101 )
Change subject: [tests] Give a better failure message for paraminfo_tests ......................................................................
[tests] Give a better failure message for paraminfo_tests
Currently we get an assertion error listing two sets when the first set is not greater or equal than the second.
Now calculate the difference which values are in the second and not in the first set as expected.
This is an improvement to detect the missing parameter in the first.
Bug: T218506 Change-Id: Ibcdffd5050c136805d48bf5dddd67011d81d84d7 --- M tests/paraminfo_tests.py 1 file changed, 6 insertions(+), 1 deletion(-)
Approvals: Dvorapa: Looks good to me, but someone else must approve Lokal Profil: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/paraminfo_tests.py b/tests/paraminfo_tests.py index 8ae81d0..63e501a 100644 --- a/tests/paraminfo_tests.py +++ b/tests/paraminfo_tests.py @@ -49,7 +49,12 @@ def _check_param_superset(self, site, module, parameter, expected): """Check that a parameter only contains entries in expected list.""" values = self._get_param_values(site, module, parameter) - self.assertGreaterEqual(set(expected), set(values)) + exp = set(expected) + val = set(values) + if not exp.issuperset(val): + diff = val - exp + self.fail('Unexpected param{} {} in values' + .format('s' if len(diff) > 1 else '', diff))
class MediaWikiKnownTypesTestCase(KnownTypesTestBase,
pywikibot-commits@lists.wikimedia.org