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.

classification
Title: "make test" fails on systems without internet access
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: nadeem.vawda Nosy List: brett.cannon, eric.araujo, ezio.melotti, nadeem.vawda, pitrou, python-dev
Priority: low Keywords: patch

Created on 2011-08-21 14:08 by eric.araujo, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
i12804.patch nadeem.vawda, 2011-08-21 14:23 review
Messages (16)
msg142621 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-08-21 14:08
When I run make test on 3.3 now, I get failures because the tests try to make HTTP requests.
msg142622 - (view) Author: Nadeem Vawda (nadeem.vawda) * (Python committer) Date: 2011-08-21 14:23
Are the failures because the machine you're running the test on doesn't
have internet access? Or are there problems with some of the tests?

The attached patch should solve the problem.
msg142623 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-08-21 14:32
Yes, the machine did not have Internet access.  Before the run_tests.py patch, the urlfetch resource was not enabled by default.

I don’t want to disconnect to test the patch, but it looks good:
/home/wok/python/3.3/python -W default -bb -E -m test -r -w -j 0 -u all,-largefile,-urlfetch,-audio,-gui

Thanks!
msg142624 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-08-21 14:33
> Before the run_tests.py patch, the urlfetch resource was not enabled
> by default.

I’m referring to the addition of run_tests.py, not this patch.
msg142625 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-08-21 14:42
New changeset 228fd2bd83a5 by Nadeem Vawda in branch 'default':
Issue #12804: Prevent "make test" from using network resources.
http://hg.python.org/cpython/rev/228fd2bd83a5
msg144734 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-10-01 14:37
Please consider reverting this patch. If you have flaky network connection, you can override the test flags yourself.
msg144736 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-10-01 14:45
New changeset 7fabd75a6ae4 by Antoine Pitrou in branch 'default':
Backout of changeset 228fd2bd83a5 by Nadeem Vawda in branch 'default':
http://hg.python.org/cpython/rev/7fabd75a6ae4
msg144737 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-10-01 14:48
Change reverted. "make test" should run a comprehensive test of Python's facilities, and that includes network facilities. We only exclude functionality where testing is hostile to the user (largefile,audio,gui).

You could add "make offlinetest" if you care, though.
msg144772 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-10-02 13:07
I don’t have a flaky connection, I have none at all; until this change I could always run just use “make test” for all Python versions.  OTOH, I agree with your point that testing networking facilities in the standard test suite makes sense, as most people probably have network access.  If it is easy to detect network availability programmatically, we could just use the skip system.
msg144785 - (view) Author: Nadeem Vawda (nadeem.vawda) * (Python committer) Date: 2011-10-02 22:27
> Change reverted. "make test" should run a comprehensive test of
> Python's facilities

Fair enough.

> If it is easy to detect network availability programmatically, we could
> just use the skip system.

+1. I don't know if there is a reasonable way to do this, but if so, that
would be the best solution.
msg144787 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-10-02 22:45
> > If it is easy to detect network availability programmatically, we could
> > just use the skip system.
> 
> +1. I don't know if there is a reasonable way to do this, but if so, that
> would be the best solution.

Actually, the skip system is already supposed to work for that if used
properly (see test.support.transient_internet()). However, perhaps it
actually doesn't work in all situations.
msg144792 - (view) Author: Nadeem Vawda (nadeem.vawda) * (Python committer) Date: 2011-10-02 23:03
Oh, neat. I'll take a look at that when I get a chance.
msg144810 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2011-10-03 10:09
FWIW there's also support.open_urlresource that can be used to download test data.  open_urlresouce calls requires('urlfetch') and skips the test when the resource is not enabled.  For instance, test_normalization uses it:
try:
    testdata = support.open_urlresource(TESTDATAURL, encoding="utf-8",
                                        check=check_version)
except (IOError, HTTPException):
    self.skipTest("Could not retrieve " + TESTDATAURL)
self.addCleanup(testdata.close)

This also saves the file on the disk and reuses it when the test is run again, so the connection is actually used once and only if available.
msg144898 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-10-04 16:17
> Actually, the skip system is already supposed to work for that if used
> properly (see test.support.transient_internet()). However, perhaps it
> actually doesn't work in all situations.

It’s better than that: nearly all tests requiring network access use skips, it’s only a few modules like test_urllib*net that fails instead of skipping (certainly because it relied on the urlfetch resource being disabled by default).
msg151934 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-01-25 06:44
New changeset 585d3664da89 by Nadeem Vawda in branch 'default':
Issue #12804: Fix test failures on systems without internet access.
http://hg.python.org/cpython/rev/585d3664da89
msg152333 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-01-30 17:22
Thanks!
History
Date User Action Args
2022-04-11 14:57:20adminsetgithub: 57013
2012-01-30 17:22:21eric.araujosetmessages: + msg152333
2012-01-25 07:32:07nadeem.vawdasetstatus: open -> closed
resolution: fixed
stage: needs patch -> resolved
2012-01-25 06:44:45python-devsetmessages: + msg151934
2011-10-04 16:17:08eric.araujosetmessages: + msg144898
2011-10-03 10:09:57ezio.melottisetnosy: + ezio.melotti
messages: + msg144810
2011-10-02 23:03:30nadeem.vawdasetassignee: nadeem.vawda
messages: + msg144792
2011-10-02 22:45:52pitrousetmessages: + msg144787
2011-10-02 22:27:40nadeem.vawdasettitle: make test should not enable the urlfetch resource -> "make test" fails on systems without internet access
messages: + msg144785
stage: needs patch
2011-10-02 13:07:52eric.araujosetmessages: + msg144772
2011-10-01 14:48:27pitrousetpriority: normal -> low
resolution: fixed -> (no value)
messages: + msg144737

components: + Tests
type: behavior
stage: resolved -> (no value)
2011-10-01 14:45:26python-devsetmessages: + msg144736
2011-10-01 14:37:49pitrousetstatus: closed -> open
nosy: + brett.cannon, pitrou
messages: + msg144734

2011-08-21 14:44:37nadeem.vawdasetstatus: open -> closed
resolution: fixed
stage: resolved
2011-08-21 14:42:15python-devsetnosy: + python-dev
messages: + msg142625
2011-08-21 14:33:06eric.araujosetmessages: + msg142624
2011-08-21 14:32:28eric.araujosetmessages: + msg142623
2011-08-21 14:23:19nadeem.vawdasetfiles: + i12804.patch
keywords: + patch
messages: + msg142622
2011-08-21 14:08:21eric.araujocreate