Fix doctests and enable in jenkins nosetests

Doctests in these files all failed.
- threadedhttp: incomplete test case
- api: used 'site=mysite' without declaring mysite
- i18n: used a message name which didnt exist, and included a wrong
  response
- tools: used print foo instead of print(foo); used xrange

Also fix api main(), which imported 'logging' from pywikibot, which
is no longer supported.

Bug: 72227
Change-Id: Ie92671e746cc10dab769d0ec4116d0ef0961c41e
Merge "Fix doctests and enable in jenkins nosetests"