From: Quentin Pradet <quentin.pradet@gmail.com>
Date: Sun, 5 Nov 2023 21:28:59 +0400
Subject: Run test_requesting_large_resources_via_ssl separately

Origin: https://github.com/urllib3/urllib3/pull/3181
---
 pyproject.toml                            |  1 +
 test/conftest.py                          | 26 ++++++++++++++++++++++++++
 test/with_dummyserver/test_socketlevel.py |  6 +-----
 3 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/pyproject.toml b/pyproject.toml
index bd75da3..773249b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -84,6 +84,7 @@ python_classes = ["Test", "*TestCase"]
 markers = [
     "limit_memory: Limit memory with memray",
     "requires_network: This test needs access to the Internet",
+    "integration: Slow integrations tests not run by default",
 ]
 log_level = "DEBUG"
 filterwarnings = [
diff --git a/test/conftest.py b/test/conftest.py
index 9aafdac..f464f70 100644
--- a/test/conftest.py
+++ b/test/conftest.py
@@ -20,6 +20,32 @@ from urllib3.util import ssl_
 from .tz_stub import stub_timezone_ctx
 
 
+def pytest_addoption(parser: pytest.Parser) -> None:
+    parser.addoption(
+        "--integration",
+        action="store_true",
+        default=False,
+        help="run integration tests only",
+    )
+
+
+def pytest_collection_modifyitems(
+    config: pytest.Config, items: list[pytest.Item]
+) -> None:
+    integration_mode = bool(config.getoption("--integration"))
+    skip_integration = pytest.mark.skip(
+        reason="skipping, need --integration option to run"
+    )
+    skip_normal = pytest.mark.skip(
+        reason="skipping non integration tests in --integration mode"
+    )
+    for item in items:
+        if "integration" in item.keywords and not integration_mode:
+            item.add_marker(skip_integration)
+        elif integration_mode and "integration" not in item.keywords:
+            item.add_marker(skip_normal)
+
+
 class ServerConfig(typing.NamedTuple):
     scheme: str
     host: str
diff --git a/test/with_dummyserver/test_socketlevel.py b/test/with_dummyserver/test_socketlevel.py
index cae6b24..32bf5e2 100644
--- a/test/with_dummyserver/test_socketlevel.py
+++ b/test/with_dummyserver/test_socketlevel.py
@@ -11,7 +11,6 @@ import select
 import shutil
 import socket
 import ssl
-import sys
 import tempfile
 import time
 import typing
@@ -1603,10 +1602,7 @@ class TestSSL(SocketDummyServerTestCase):
     # SecureTransport can read only small pieces of data at the moment.
     # https://github.com/urllib3/urllib3/pull/2674
     @notSecureTransport()
-    @pytest.mark.skipif(
-        os.environ.get("CI") == "true" and sys.implementation.name == "pypy",
-        reason="too slow to run in CI",
-    )
+    @pytest.mark.integration
     @pytest.mark.parametrize(
         "preload_content,read_amt", [(True, None), (False, None), (False, 2**31)]
     )
