Issue34031
Created on 2018-07-03 12:35 by pablogsal, last changed 2022-04-11 14:59 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 8091 | merged | python-dev, 2018-07-04 18:38 | |
| PR 8223 | merged | miss-islington, 2018-07-10 09:48 | |
| PR 8224 | merged | miss-islington, 2018-07-10 09:49 | |
| PR 8225 | merged | taleinat, 2018-07-10 10:04 | |
| Messages (8) | |||
|---|---|---|---|
| msg320976 - (view) | Author: Pablo Galindo Salgado (pablogsal) * ![]() |
Date: 2018-07-03 12:35 | |
In /Lib/test/test_urllib2_localnet.py there is an incorrect usage of unittest.TestCase.fail (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
----------------------------------------------------------------------
|
|||
| msg321008 - (view) | Author: stoksc (stoksc) * | Date: 2018-07-04 01:57 | |
Hey again @pablogsal. Thanks for reviewing the email issue again. I'll try to fix and submit a PR for this if that's ok. |
|||
| msg321045 - (view) | Author: Karthikeyan Singaravelan (xtreak) * ![]() |
Date: 2018-07-04 14:40 | |
This might be slightly unrelated but I grepped for similar cases and came across self.fail, "Broken file" in Lib/test/test_file.py at https://github.com/python/cpython/blob/a390cb6b6fb6638e91d699513167e8f35b47f846/Lib/test/test_file.py#L245. I think this is not triggered for broken file which I tried in the test by removing the if condition. Kindly correct me if I am wrong on the syntax or this should be raised as a separate issue. Thanks |
|||
| msg321371 - (view) | Author: Tal Einat (taleinat) * ![]() |
Date: 2018-07-10 09:46 | |
New changeset 6b490b5db40fc29588e8e6cc23bb89c4fed74ad5 by Tal Einat (Bradley Laney) in branch 'master': bpo-34031: fix incorrect usage of self.fail in two tests (GH-8091) https://github.com/python/cpython/commit/6b490b5db40fc29588e8e6cc23bb89c4fed74ad5 |
|||
| msg321372 - (view) | Author: miss-islington (miss-islington) | Date: 2018-07-10 10:08 | |
New changeset 125371d2c617d886e1a15b8f940ce29124cdc79c by Miss Islington (bot) in branch '3.7': bpo-34031: fix incorrect usage of self.fail in two tests (GH-8091) https://github.com/python/cpython/commit/125371d2c617d886e1a15b8f940ce29124cdc79c |
|||
| msg321373 - (view) | Author: miss-islington (miss-islington) | Date: 2018-07-10 10:13 | |
New changeset cb14eb7eedf36cd21aaf41c4d3eb1e6521fa7b11 by Miss Islington (bot) in branch '3.6': bpo-34031: fix incorrect usage of self.fail in two tests (GH-8091) https://github.com/python/cpython/commit/cb14eb7eedf36cd21aaf41c4d3eb1e6521fa7b11 |
|||
| msg321376 - (view) | Author: Tal Einat (taleinat) * ![]() |
Date: 2018-07-10 10:28 | |
New changeset 6f036bb67d5a20c86c29ea5aeace563e3751baab by Tal Einat in branch '2.7': [2.7] bpo-34031: fix incorrect usage of self.fail in two tests (GH-8091) (#8225) https://github.com/python/cpython/commit/6f036bb67d5a20c86c29ea5aeace563e3751baab |
|||
| msg321377 - (view) | Author: Tal Einat (taleinat) * ![]() |
Date: 2018-07-10 10:30 | |
Thanks for the PR, stoksc! |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:02 | admin | set | github: 78212 |
| 2018-07-10 10:30:04 | taleinat | set | status: open -> closed resolution: fixed messages: + msg321377 stage: patch review -> resolved |
| 2018-07-10 10:28:13 | taleinat | set | messages: + msg321376 |
| 2018-07-10 10:13:10 | miss-islington | set | messages: + msg321373 |
| 2018-07-10 10:08:46 | miss-islington | set | nosy:
+ miss-islington messages: + msg321372 |
| 2018-07-10 10:04:18 | taleinat | set | pull_requests: + pull_request7763 |
| 2018-07-10 09:49:55 | miss-islington | set | pull_requests: + pull_request7762 |
| 2018-07-10 09:48:02 | miss-islington | set | pull_requests: + pull_request7761 |
| 2018-07-10 09:46:49 | taleinat | set | nosy:
+ taleinat messages: + msg321371 |
| 2018-07-04 18:38:54 | python-dev | set | keywords:
+ patch stage: patch review pull_requests: + pull_request7692 |
| 2018-07-04 15:51:14 | pablogsal | set | versions: - Python 3.4, Python 3.5 |
| 2018-07-04 14:40:54 | xtreak | set | nosy:
+ xtreak messages: + msg321045 |
| 2018-07-04 01:57:58 | stoksc | set | nosy:
+ stoksc messages: + msg321008 |
| 2018-07-03 14:32:33 | pablogsal | set | keywords:
+ easy title: Incorrect usage of unittest.TestCase in test_urllib2_localnet -> [EASY] Incorrect usage of unittest.TestCase in test_urllib2_localnet |
| 2018-07-03 12:35:53 | pablogsal | set | messages: - msg320975 |
| 2018-07-03 12:35:49 | pablogsal | set | messages: + msg320976 |
| 2018-07-03 12:35:20 | pablogsal | create | |
