Page MenuHomePhabricator

http_tests.LiveFakeUserAgentTestCase fails
Closed, ResolvedPublicBUG REPORT

Description

This test is SKIPPED in travis.

tests/http_tests.py::LiveFakeUserAgentTestCase::test_fetch_with_fake_useragent SKIPPED

After installing locally fake_useragent, test failed.

python -m unittest tests.http_tests.LiveFakeUserAgentTestCase
tests: max_retries reduced from 15 to 1
F
======================================================================
FAIL: test_fetch_with_fake_useragent (tests.http_tests.LiveFakeUserAgentTestCase)
Test method with fake_useragent module.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/user/python/core/tests/http_tests.py", line 352, in test_fetch_with_fake_useragent
    self._test_fetch_use_fake_user_agent()
  File "/home/user/python/core/tests/http_tests.py", line 336, in _test_fetch_use_fake_user_agent
    self.assertEqual(r.headers['user-agent'], http.user_agent())
AssertionError: 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/[57 chars]7.36' != 'python -m unittest Pywikibot/5.0.0.dev0 ([40 chars]al.0'
- Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.2309.372 Safari/537.36
+ python -m unittest Pywikibot/5.0.0.dev0 (g13409) requests/2.24.0 Python/3.8.3.final.0


----------------------------------------------------------------------
Ran 1 test in 3.103s

FAILED (failures=1)

This is almost certainly a regression of https://gerrit.wikimedia.org/r/c/pywikibot/core/+/634238

Event Timeline

Change 634829 had a related patch set uploaded (by Mpaa; owner: Mpaa):
[pywikibot/core@master] [bugfix] fix http_tests.LiveFakeUserAgentTestCase

https://gerrit.wikimedia.org/r/634829

As reference for user agent, this task gives some background: T152075

And docs: https://www.mediawiki.org/wiki/Manual:Pywikibot/User-agent

Xqt triaged this task as High priority.
Xqt changed the subtype of this task from "Task" to "Bug Report".
Xqt added a project: Pywikibot-tests.

Change 634829 merged by jenkins-bot:
[pywikibot/core@master] [bugfix] fix http_tests.LiveFakeUserAgentTestCase

https://gerrit.wikimedia.org/r/634829