jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/557510 )
Change subject: [bugfix] Test for existing users for wikipedia family only ......................................................................
[bugfix] Test for existing users for wikipedia family only
- user in userlist are not expected outside wikipedia family; change TestUserList.test_users accordingly - use subTest to verify all users - use enumerate for cnt counter
Bug: T240059 Change-Id: I3cb20ead1e1a9c50c6221114dd28a096a40082a9 --- M tests/site_tests.py 1 file changed, 8 insertions(+), 9 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/site_tests.py b/tests/site_tests.py index d700c51..63b532a 100644 --- a/tests/site_tests.py +++ b/tests/site_tests.py @@ -2146,15 +2146,14 @@ user_list = ['Jimbo Wales', 'Brion VIBBER', 'Tim Starling'] missing = ['A username that should not exist 1A53F6E375B5'] all_users = user_list + missing - cnt = 0 - for user in self.site.users(all_users): - self.assertIsInstance(user, dict) - self.assertIn(user['name'], all_users) - if user['name'] == missing[0]: - self.assertIn('missing', user) - else: - self.assertNotIn('missing', user) - cnt += 1 + for cnt, user in enumerate(self.site.users(all_users), start=1): + with self.subTest(user=user['name']): + self.assertIsInstance(user, dict) + self.assertIn(user['name'], all_users) + if user['name'] == missing[0]: + self.assertIn('missing', user) + elif self.site.family.name == 'wikipedia': + self.assertNotIn('missing', user) self.assertEqual(cnt, len(all_users), 'Some test usernames not found')
pywikibot-commits@lists.wikimedia.org