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: Tests needing network flag?
Type: Stage: resolved
Components: Tests Versions: Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: brett.cannon, christian.heimes, eric.araujo, georg.brandl, techtonik
Priority: normal Keywords: easy, patch

Created on 2007-12-19 15:17 by skip.montanaro, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
network.diff skip.montanaro, 2007-12-19 15:17
1659.no_network.diff techtonik, 2010-04-01 16:58
Messages (10)
msg58806 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2007-12-19 15:17
While riding to work today I ran the test suite on trunk.  The following
tests failed due to lack of network connectivity:

    test_socket
    test_socket_ssl
    test_ssl
    test_urllib2

These tests should probably either require -u network or should themselves
check to see if the network is available and skip those tests requiring
network connectivity.  In fact, regrtest.py's comments list test_socket_ssl
as requiring the network resource.  That seems to have regressed since 2.5

Simple patch attached.

Skip
msg60241 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2008-01-19 22:47
This is an easy patch, but I'd like someone to at least verify it works
before checking it in...  nudge, nudge, wink, wink...
msg60243 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-01-19 22:50
This won't work without corresponding changes in regrtest.py; it
currently  mentions test_socket_ssl and test_timeout explicitly.
msg60258 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2008-01-20 02:31
> it currently  mentions test_socket_ssl and test_timeout explicitly

"it" being regrtest.py?  This patch works for me.  In what way is
regrtest's reference to test_socket_ssl (for example) a problem?  All
I did for that test was tighten up the requirements to run the test.
I didn't do anything with test_timeout.  It's unclear to me why you
mentioned it.
msg60263 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-01-20 08:44
Sorry, I was being unclear. I grepped through Lib/test for
"skip_expected" and couldn't find a location where e.g. the newly set
test_urllib2.skip_expected would be accessed.

regrtest.py only accesses this attribute on the two modules I named.
msg60267 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2008-01-20 09:08
I've disabled a single test in socket if the network resource isn't
enable. It fixes the problem for me when I'm offline or my WLAN is
broken again. The test was also called by test_ssl.
msg63519 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2008-03-14 01:36
I think, for the cases that are not special-cased by regrtest,
test.test_support.requires() should be used.
msg102106 - (view) Author: anatoly techtonik (techtonik) Date: 2010-04-01 16:58
Updated patch.

    test_socket  - whole suite will be skipped
    test_socket_ssl - no more avail
    test_ssl     - only test that require network will be marked as skipped
    test_urllib2 - untouched, requires fine-grained approach, probably for separate ticket
msg102107 - (view) Author: anatoly techtonik (techtonik) Date: 2010-04-01 17:01
I propose to split this issue.

One is to test which tests that marked with `test_support.requires('network')` _really_ need network connection.

Second is annotation of appropriate methods instead of whole test suite to count exact number of tests skipped due to absent resource.
msg154107 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-02-24 04:10
All tests now use regrtest resources and/or unittest skips and/or test.support.transient_internet.  I ran the faulty tests mentioned in this report while disconnected and got no failure, only skips.  Closing as duplicate/out of date.
History
Date User Action Args
2022-04-11 14:56:29adminsetgithub: 46000
2012-02-24 04:10:02eric.araujosetstatus: open -> closed

nosy: + eric.araujo
messages: + msg154107

resolution: out of date
stage: resolved
2010-05-20 20:42:26skip.montanarosetassignee: skip.montanaro ->
2010-05-20 20:37:11skip.montanarosetnosy: - skip.montanaro
2010-04-01 17:01:02techtoniksetmessages: + msg102107
2010-04-01 16:58:04techtoniksetfiles: + 1659.no_network.diff

components: + Tests
versions: + Python 2.7
keywords: + patch
nosy: + techtonik

messages: + msg102106
2008-03-14 01:36:03brett.cannonsetassignee: brett.cannon -> skip.montanaro
messages: + msg63519
2008-01-20 09:08:51christian.heimessetnosy: + christian.heimes
messages: + msg60267
2008-01-20 08:44:24georg.brandlsetmessages: + msg60263
2008-01-20 02:31:48skip.montanarosetmessages: + msg60258
2008-01-19 22:50:49georg.brandlsetnosy: + georg.brandl
messages: + msg60243
2008-01-19 22:47:12skip.montanarosetkeywords: + easy
messages: + msg60241
2007-12-19 21:09:25brett.cannonsetassignee: brett.cannon
nosy: + brett.cannon
2007-12-19 15:17:30skip.montanarocreate