rasterio icon indicating copy to clipboard operation
rasterio copied to clipboard

Skip network-dependent tests if no connection

Open perrygeo opened this issue 9 years ago • 1 comments

Not a high priority but it would help in some cases like working on an airplane with ridiculously over-priced wifi

tests/test_env.py::test_s3_open_with_session FAILED
tests/test_env.py::test_s3_open_with_default_session FAILED
tests/test_env.py::test_open_https_vsicurl FAILED
tests/test_env.py::test_s3_rio_info FAILED
tests/test_env.py::test_https_rio_info FAILED

perrygeo avatar Jul 06 '16 20:07 perrygeo

untested

try:
    import http.client as httplib
except ImportError:
    import httplib

def connected(host="www.example.com"):
    conn = httplib.HTTPConnection(host)
    try:
        conn.request("HEAD", "/")
        return True
    except:
        return False

perrygeo avatar Jul 06 '16 20:07 perrygeo