This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pablogsal
Recipients pablogsal
Date 2018-07-03.12:35:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1530621320.5.0.56676864532.issue34031@psf.upfronthosting.co.za>
In-reply-to
Content
In /Lib/test/test_urllib2_localnet.py there is an incorrect usage of unittest.TestCase (an extra comma makes it use two arguments instead of one):

class BasicAuthTests(unittest.TestCase):
    ...

    def test_basic_auth_success(self):
        ...
        try:
            self.assertTrue(urllib.request.urlopen(self.server_url))
        except urllib.error.HTTPError:
            self.fail("Basic auth failed for the url: %s", self.server_url)

here self.fail takes two argument, but it only admits one. This produces this traceback if there are proxy issues when running the tests:

Traceback (most recent call last):
  File "/home7/pablogsal/Python-3.7.0/Lib/test/test_urllib2_localnet.py", line 307, in test_basic_auth_success
    self.assertTrue(urllib.request.urlopen(self.server_url))
  File "/home/pablogsal/Python-3.7.0/Lib/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/home/pablogsal/Python-3.7.0/Lib/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/home/pablogsal/Python-3.7.0/Lib/urllib/request.py", line 641, in http_response
    'http', request, response, code, msg, hdrs)
  File "/home/pablogsal/Python-3.7.0/Lib/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/home/pablogsal/Python-3.7.0/Lib/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/home/pablogsal/Python-3.7.0/Lib/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pablogsal/Python-3.7.0/Lib/test/test_urllib2_localnet.py", line 309, in test_basic_auth_success
    self.fail("Basic auth failed for the url: %s", self.server_url)
TypeError: fail() takes from 1 to 2 positional arguments but 3 were given

----------------------------------------------------------------------
History
Date User Action Args
2018-07-03 12:35:53pablogsalunlinkissue34031 messages
2018-07-03 12:35:20pablogsalsetrecipients: + pablogsal
2018-07-03 12:35:20pablogsalsetmessageid: <1530621320.5.0.56676864532.issue34031@psf.upfronthosting.co.za>
2018-07-03 12:35:20pablogsallinkissue34031 messages
2018-07-03 12:35:20pablogsalcreate