Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pytest_remotedata/disable_internet.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ def check_internet_off(original_function, allow_astropy_data=False,
"""

def new_function(*args, **kwargs):
if socket.socket != socket_original:
raise OSError(f"Internet status is INTERNET_OFF={INTERNET_OFF}, "
"but a remote function was created.")
if isinstance(args[0], socket.socket):
if not args[0].family in (socket.AF_INET, socket.AF_INET6):
# Should be fine in all but some very obscure cases
Expand Down