{"library":"pytest-remotedata","title":"Pytest Remote Data Plugin","description":"Pytest-remotedata is a pytest plugin that provides control over unit tests requiring access to remote data from the internet. It allows developers to mark tests that either need remote data or should only run when internet access is disabled, helping to manage test suite runtime and dependencies. Originally part of the Astropy core package, it is currently at version 0.4.1 and sees active development with a consistent release cadence.","language":"python","status":"active","last_verified":"Sat May 16","install":{"commands":["pip install pytest-remotedata"],"cli":{"name":"pytest","version":"pytest 9.0.3"}},"imports":["@pytest.mark.remote_data","@pytest.mark.internet_off"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import pytest\nfrom urllib.request import urlopen\nimport os\n\n@pytest.mark.remote_data\ndef test_access_remote_data():\n    # This test will only run if pytest is invoked with --remote-data\n    try:\n        response = urlopen('https://httpbin.org/get', timeout=5)\n        assert response.status == 200\n        print(\"Successfully accessed remote data.\")\n    except Exception as e:\n        pytest.fail(f\"Failed to access remote data: {e}\")\n\n@pytest.mark.internet_off\ndef test_no_internet_access():\n    # This test will run if pytest is invoked without --remote-data or with --remote-data=none\n    # and should ideally not attempt network access.\n    # For demonstration, we simulate no internet by trying to connect to a non-existent local address.\n    import socket\n    with pytest.raises(socket.error): # Expect a connection error if truly offline\n        socket.create_connection(('localhost', 65535), timeout=0.1)\n    print(\"Test passed when internet access is (simulated) off.\")\n\n# To run the remote data test:\n# pytest --remote-data your_test_file.py\n#\n# To run the internet_off test (and skip remote_data tests):\n# pytest your_test_file.py  (or pytest --remote-data=none your_test_file.py)","lang":"python","description":"To use `pytest-remotedata`, you mark your test functions with `@pytest.mark.remote_data` for tests requiring internet access or `@pytest.mark.internet_off` for tests that expect no internet. When `pytest` is run, tests marked with `remote_data` are skipped by default. They will only execute if the `--remote-data` command-line option (or `--remote-data=any`) is provided to `pytest`. Conversely, tests marked with `internet_off` will run when `--remote-data` is not provided (or `--remote-data=none`), and be skipped if `--remote-data` is active.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-16","installed_version":"0.4.1","pypi_latest":"0.4.1","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":2.6,"avg_import_s":null,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pytest-remotedata","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"30.7M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pytest-remotedata","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.6,"import_time_s":null,"mem_mb":null,"disk_size":"31M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pytest-remotedata","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"33.6M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pytest-remotedata","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.5,"import_time_s":null,"mem_mb":null,"disk_size":"34M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pytest-remotedata","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"25.2M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pytest-remotedata","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.5,"import_time_s":null,"mem_mb":null,"disk_size":"26M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pytest-remotedata","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"25.0M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pytest-remotedata","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":2.5,"import_time_s":null,"mem_mb":null,"disk_size":"25M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pytest-remotedata","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"30.0M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pytest-remotedata","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":3,"import_time_s":null,"mem_mb":null,"disk_size":"31M"}]}}