class TestMediaInfoReadonlyEditing(TestCase): """Test writing structured data of FilePage.""" # Create valid API requests which will fail to missing permission. # commons.wikimedia.beta.wmflabs.org family = 'commons' code = 'beta'
fails with:
Traceback (most recent call last): File "/src/pywikibot/login.py", line 102, in __init__ user = code_to_usr.get(site.code) or code_to_usr['*'] KeyError: '*' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/src/tests/file_tests.py", line 533, in test_edit_claims item.addClaim(new_claim) File "/src/pywikibot/page/_wikibase.py", line 533, in addClaim self.repo.addClaim(self, claim, bot=bot, **kwargs) File "/src/pywikibot/site/_decorators.py", line 86, in callee return fn(self, *args, **kwargs) File "/src/pywikibot/site/_datasite.py", line 344, in addClaim 'token': self.tokens['csrf'], File "/src/pywikibot/site/_tokenwallet.py", line 39, in __getitem__ self.site.login() File "/src/pywikibot/site/_apisite.py", line 432, in login user=self.username()) File "/src/pywikibot/login.py", line 110, in __init__ "'myUsername'".format(site=site)) pywikibot.exceptions.NoUsernameError: ERROR: username for commons:beta is undefined. If you have a username for that site, please add a line to user config file (user_config.py) as follows: usernames['commons']['beta'] = 'myUsername'
We should put that usernames['commons']['beta'] = 'myUsername' somewhere.
It's weird it suddenly stopped working. It could be some upstream change in login management.