File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616## along with this program. If not, see
1717## <http://www.gnu.org/licenses/>.
1818
19+ import http .client
1920import locale
2021import os
2122import shutil
2627import exiv2
2728
2829
30+ # Source - https://stackoverflow.com/a/29854274
31+ # Posted by Ivelin, modified by community. See post 'Timeline' for change history
32+ # Retrieved 2026-03-16, License - CC BY-SA 4.0
33+
34+ def have_internet ():
35+ conn = http .client .HTTPSConnection ("dns.google" , timeout = 5 )
36+ try :
37+ conn .request ("HEAD" , "/" )
38+ return True
39+ except Exception :
40+ return False
41+ finally :
42+ conn .close ()
43+
44+
2945class TestBasicIoModule (unittest .TestCase ):
3046 @classmethod
3147 def setUpClass (cls ):
3248 test_dir = os .path .dirname (__file__ )
3349 cls .image_path = os .path .join (test_dir , 'image_02.jpg' )
3450 cls .data = b'The quick brown fox jumps over the lazy dog'
3551
52+ @unittest .skipUnless (have_internet (), 'Requires Internet access' )
3653 @unittest .skipUnless (exiv2 .versionInfo ()['EXV_USE_CURL' ],
3754 'CurlIo not included' )
3855 def test_CurlIo (self ):
You can’t perform that action at this time.
0 commit comments