Steps to replicate the issue (include links if applicable):
- checkout pywikibot-git to 77482f4bab1822c7b604f7d1a4787ad2742ec991
- Python 3.9.13
- MacOS 12.6.1
- pytest tests/page_tests.py::TestShortLink::test_create_short_link
- put the following in user-config.py:
family = 'wikipedia' mylang = 'en' authenticate['test.wikipedia.org'] = (...)
where the ... are valid oauth credentials
What happens?:
Test fails with:
ERROR tests/page_tests.py::TestShortLink::test_create_short_link - pywikibot.exceptions.NoUsernameError: No username has been defined in your user config file: you have to add in this file the following line:
If you comment out the authenticate line, the test passes. This configuration also passes:
family = 'wikipedia' mylang = 'en' #authenticate['test.wikipedia.org'] = (...) authenticate['en.wikipedia.org'] = (...)
but this fails (i.e. both authenticate lines active):
family = 'wikipedia' mylang = 'en' authenticate['test.wikipedia.org'] = (...) authenticate['en.wikipedia.org'] = (...)
This smells like the same problem as T336624.
I also see T223865, T244062, and T256540 all of which describe mysterious failures of test_create_short_link which were apparently related to authentication and never completely understood. Might be related.