We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
flaky and pytest-memray incompatible
### Subject

```
______________________________________________________________________________________________________ TestHTTPProxyManager.test_forwarding_proxy_request_timeout[https-https-True] ______________________________________________________________________________________________________
Traceback (most recent call last):
  File "/home/graingert/projects/urllib3/.nox/test-3-11/lib/python3.11/site-packages/pytest_memray/plugin.py", line 122, in wrapper
    result: object | None = func(*args, **kwargs)
                            ^^^^^^^^^^^^^^^^^^^^^
  File "/home/graingert/projects/urllib3/.nox/test-3-11/lib/python3.11/site-packages/pytest_memray/plugin.py", line 121, in wrapper
    with Tracker(result_file):
  File "src/memray/_memray.pyx", line 404, in memray._memray.Tracker.__enter__
RuntimeError: No more than one Tracker instance can be active at the same time
```
caused by a flaky test:
```
===Flaky Test Report===

test_forwarding_proxy_request_timeout[https-https-True] failed (1 runs remaining out of 2).
    <class 'AssertionError'>
    assert <class 'urllib3.exceptions.ProxyError'> == ReadTimeoutError
 +  where <class 'urllib3.exceptions.ProxyError'> = type(ProxyError('Unable to connect to proxy', ReadTimeoutError("HTTPSConnectionPool(host='240.0.0.0', port=443): Read timed out. (read timeout=0.01)")))
 +    where ProxyError('Unable to connect to proxy', ReadTimeoutError("HTTPSConnectionPool(host='240.0.0.0', port=443): Read timed out. (read timeout=0.01)")) = MaxRetryError('HTTPSConnectionPool(host=\'240.0.0.0\', port=443): Max retries exceeded with url: https://240.0.0.0 (Caused by ProxyError(\'Unable to connect to proxy\', ReadTimeoutError("HTTPSConnectionPool(host=\'240.0.0.0\', port=443): Read timed out. (read timeout=0.01)")))').reason
 +      where MaxRetryError('HTTPSConnectionPool(host=\'240.0.0.0\', port=443): Max retries exceeded with url: https://240.0.0.0 (Caused by ProxyError(\'Unable to connect to proxy\', ReadTimeoutError("HTTPSConnectionPool(host=\'240.0.0.0\', port=443): Read timed out. (read timeout=0.01)")))') = <ExceptionInfo MaxRetryError('HTTPSConnectionPool(host=\'240.0.0.0\', port=443): Max retries exceeded with url: https://240.0.0.0 (Ca...proxy\', ReadTimeoutError("HTTPSConnectionPool(host=\'240.0.0.0\', port=443): Read timed out. (read timeout=0.01)")))') tblen=10>.value
    [<TracebackEntry /home/graingert/projects/urllib3/test/with_dummyserver/test_proxy_poolmanager.py:484>]
test_forwarding_proxy_request_timeout[https-https-True] failed; it passed 0 out of the required 1 times.
    <class 'RuntimeError'>
    No more than one Tracker instance can be active at the same time
    [<TracebackEntry /home/graingert/projects/urllib3/.nox/test-3-11/lib/python3.11/site-packages/pytest_memray/plugin.py:122>, <TracebackEntry /home/graingert/projects/urllib3/.nox/test-3-11/lib/python3.11/site-packages/pytest_memray/plugin.py:121>, <TracebackEntry src/memray/_memray.pyx:404>]

```

see also https://github.com/bloomberg/pytest-memray/issues/53


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `noxfile.py`
Content:
```
1 from __future__ import annotations
2 
3 import os
4 import shutil
5 import subprocess
6 import sys
7 
8 import nox
9 
10 SOURCE_FILES = [
11     "docs/",
12     "dummyserver/",
13     "src/",
14     "test/",
15     "noxfile.py",
16     "setup.py",
17 ]
18 
19 
20 def tests_impl(
21     session: nox.Session,
22     extras: str = "socks,secure,brotli,zstd",
23     byte_string_comparisons: bool = True,
24 ) -> None:
25     # Install deps and the package itself.
26     session.install("-r", "dev-requirements.txt")
27     session.install(f".[{extras}]")
28 
29     # Show the pip version.
30     session.run("pip", "--version")
31     # Print the Python version and bytesize.
32     session.run("python", "--version")
33     session.run("python", "-c", "import struct; print(struct.calcsize('P') * 8)")
34     # Print OpenSSL information.
35     session.run("python", "-m", "OpenSSL.debug")
36 
37     memray_supported = True
38     if sys.implementation.name != "cpython" or sys.version_info < (3, 8):
39         memray_supported = False  # pytest-memray requires CPython 3.8+
40     elif sys.platform == "win32":
41         memray_supported = False
42 
43     # Inspired from https://hynek.me/articles/ditch-codecov-python/
44     # We use parallel mode and then combine in a later CI step
45     session.run(
46         "python",
47         *(("-bb",) if byte_string_comparisons else ()),
48         "-m",
49         "coverage",
50         "run",
51         "--parallel-mode",
52         "-m",
53         "pytest",
54         *("--memray", "--hide-memray-summary") if memray_supported else (),
55         "-v",
56         "-ra",
57         f"--color={'yes' if 'GITHUB_ACTIONS' in os.environ else 'auto'}",
58         "--tb=native",
59         "--no-success-flaky-report",
60         "--durations=10",
61         "--strict-config",
62         "--strict-markers",
63         *(session.posargs or ("test/",)),
64         env={"PYTHONWARNINGS": "always::DeprecationWarning"},
65     )
66 
67 
68 @nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11", "pypy"])
69 def test(session: nox.Session) -> None:
70     tests_impl(session)
71 
72 
73 @nox.session(python=["2.7"])
74 def unsupported_setup_py(session: nox.Session) -> None:
75     # Can't check both returncode and output with session.run
76     process = subprocess.run(
77         ["python", "setup.py", "install"],
78         env={**session.env},
79         text=True,
80         capture_output=True,
81     )
82     assert process.returncode == 1
83     print(process.stderr)
84     assert "Please use `python -m pip install .` instead." in process.stderr
85 
86 
87 @nox.session(python=["3"])
88 def test_brotlipy(session: nox.Session) -> None:
89     """Check that if 'brotlipy' is installed instead of 'brotli' or
90     'brotlicffi' that we still don't blow up.
91     """
92     session.install("brotlipy")
93     tests_impl(session, extras="socks,secure", byte_string_comparisons=False)
94 
95 
96 def git_clone(session: nox.Session, git_url: str) -> None:
97     """We either clone the target repository or if already exist
98     simply reset the state and pull.
99     """
100     expected_directory = git_url.split("/")[-1]
101 
102     if expected_directory.endswith(".git"):
103         expected_directory = expected_directory[:-4]
104 
105     if not os.path.isdir(expected_directory):
106         session.run("git", "clone", "--depth", "1", git_url, external=True)
107     else:
108         session.run(
109             "git", "-C", expected_directory, "reset", "--hard", "HEAD", external=True
110         )
111         session.run("git", "-C", expected_directory, "pull", external=True)
112 
113 
114 @nox.session()
115 def downstream_botocore(session: nox.Session) -> None:
116     root = os.getcwd()
117     tmp_dir = session.create_tmp()
118 
119     session.cd(tmp_dir)
120     git_clone(session, "https://github.com/boto/botocore")
121     session.chdir("botocore")
122     for patch in [
123         "0001-Mark-100-Continue-tests-as-failing.patch",
124         "0002-Stop-relying-on-removed-DEFAULT_CIPHERS.patch",
125     ]:
126         session.run("git", "apply", f"{root}/ci/{patch}", external=True)
127     session.run("git", "rev-parse", "HEAD", external=True)
128     session.run("python", "scripts/ci/install")
129 
130     session.cd(root)
131     session.install(".", silent=False)
132     session.cd(f"{tmp_dir}/botocore")
133 
134     session.run("python", "-c", "import urllib3; print(urllib3.__version__)")
135     session.run("python", "scripts/ci/run-tests")
136 
137 
138 @nox.session()
139 def downstream_requests(session: nox.Session) -> None:
140     root = os.getcwd()
141     tmp_dir = session.create_tmp()
142 
143     session.cd(tmp_dir)
144     git_clone(session, "https://github.com/psf/requests")
145     session.chdir("requests")
146     session.run(
147         "git", "apply", f"{root}/ci/0003-requests-removed-warnings.patch", external=True
148     )
149     session.run(
150         "git", "apply", f"{root}/ci/0004-requests-chunked-requests.patch", external=True
151     )
152     session.run("git", "rev-parse", "HEAD", external=True)
153     session.install(".[socks]", silent=False)
154     session.install("-r", "requirements-dev.txt", silent=False)
155 
156     session.cd(root)
157     session.install(".", silent=False)
158     session.cd(f"{tmp_dir}/requests")
159 
160     session.run("python", "-c", "import urllib3; print(urllib3.__version__)")
161     session.run("pytest", "tests")
162 
163 
164 @nox.session()
165 def format(session: nox.Session) -> None:
166     """Run code formatters."""
167     lint(session)
168 
169 
170 @nox.session
171 def lint(session: nox.Session) -> None:
172     session.install("pre-commit")
173     session.run("pre-commit", "run", "--all-files")
174 
175     mypy(session)
176 
177 
178 @nox.session(python="3.8")
179 def mypy(session: nox.Session) -> None:
180     """Run mypy."""
181     session.install("-r", "mypy-requirements.txt")
182     session.run("mypy", "--version")
183     session.run(
184         "mypy",
185         "dummyserver",
186         "noxfile.py",
187         "src/urllib3",
188         "test",
189     )
190 
191 
192 @nox.session
193 def docs(session: nox.Session) -> None:
194     session.install("-r", "docs/requirements.txt")
195     session.install(".[socks,secure,brotli,zstd]")
196 
197     session.chdir("docs")
198     if os.path.exists("_build"):
199         shutil.rmtree("_build")
200     session.run("sphinx-build", "-b", "html", "-W", ".", "_build/html")
201
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/noxfile.py b/noxfile.py
--- a/noxfile.py
+++ b/noxfile.py
@@ -56,7 +56,6 @@
         "-ra",
         f"--color={'yes' if 'GITHUB_ACTIONS' in os.environ else 'auto'}",
         "--tb=native",
-        "--no-success-flaky-report",
         "--durations=10",
         "--strict-config",
         "--strict-markers",

{"golden_diff": "diff --git a/noxfile.py b/noxfile.py\n--- a/noxfile.py\n+++ b/noxfile.py\n@@ -56,7 +56,6 @@\n         \"-ra\",\n         f\"--color={'yes' if 'GITHUB_ACTIONS' in os.environ else 'auto'}\",\n         \"--tb=native\",\n-        \"--no-success-flaky-report\",\n         \"--durations=10\",\n         \"--strict-config\",\n         \"--strict-markers\",\n", "issue": "flaky and pytest-memray incompatible\n### Subject\r\n\r\n```\r\n______________________________________________________________________________________________________ TestHTTPProxyManager.test_forwarding_proxy_request_timeout[https-https-True] ______________________________________________________________________________________________________\r\nTraceback (most recent call last):\r\n  File \"/home/graingert/projects/urllib3/.nox/test-3-11/lib/python3.11/site-packages/pytest_memray/plugin.py\", line 122, in wrapper\r\n    result: object | None = func(*args, **kwargs)\r\n                            ^^^^^^^^^^^^^^^^^^^^^\r\n  File \"/home/graingert/projects/urllib3/.nox/test-3-11/lib/python3.11/site-packages/pytest_memray/plugin.py\", line 121, in wrapper\r\n    with Tracker(result_file):\r\n  File \"src/memray/_memray.pyx\", line 404, in memray._memray.Tracker.__enter__\r\nRuntimeError: No more than one Tracker instance can be active at the same time\r\n```\r\ncaused by a flaky test:\r\n```\r\n===Flaky Test Report===\r\n\r\ntest_forwarding_proxy_request_timeout[https-https-True] failed (1 runs remaining out of 2).\r\n    <class 'AssertionError'>\r\n    assert <class 'urllib3.exceptions.ProxyError'> == ReadTimeoutError\r\n +  where <class 'urllib3.exceptions.ProxyError'> = type(ProxyError('Unable to connect to proxy', ReadTimeoutError(\"HTTPSConnectionPool(host='240.0.0.0', port=443): Read timed out. (read timeout=0.01)\")))\r\n +    where ProxyError('Unable to connect to proxy', ReadTimeoutError(\"HTTPSConnectionPool(host='240.0.0.0', port=443): Read timed out. (read timeout=0.01)\")) = MaxRetryError('HTTPSConnectionPool(host=\\'240.0.0.0\\', port=443): Max retries exceeded with url: https://240.0.0.0 (Caused by ProxyError(\\'Unable to connect to proxy\\', ReadTimeoutError(\"HTTPSConnectionPool(host=\\'240.0.0.0\\', port=443): Read timed out. (read timeout=0.01)\")))').reason\r\n +      where MaxRetryError('HTTPSConnectionPool(host=\\'240.0.0.0\\', port=443): Max retries exceeded with url: https://240.0.0.0 (Caused by ProxyError(\\'Unable to connect to proxy\\', ReadTimeoutError(\"HTTPSConnectionPool(host=\\'240.0.0.0\\', port=443): Read timed out. (read timeout=0.01)\")))') = <ExceptionInfo MaxRetryError('HTTPSConnectionPool(host=\\'240.0.0.0\\', port=443): Max retries exceeded with url: https://240.0.0.0 (Ca...proxy\\', ReadTimeoutError(\"HTTPSConnectionPool(host=\\'240.0.0.0\\', port=443): Read timed out. (read timeout=0.01)\")))') tblen=10>.value\r\n    [<TracebackEntry /home/graingert/projects/urllib3/test/with_dummyserver/test_proxy_poolmanager.py:484>]\r\ntest_forwarding_proxy_request_timeout[https-https-True] failed; it passed 0 out of the required 1 times.\r\n    <class 'RuntimeError'>\r\n    No more than one Tracker instance can be active at the same time\r\n    [<TracebackEntry /home/graingert/projects/urllib3/.nox/test-3-11/lib/python3.11/site-packages/pytest_memray/plugin.py:122>, <TracebackEntry /home/graingert/projects/urllib3/.nox/test-3-11/lib/python3.11/site-packages/pytest_memray/plugin.py:121>, <TracebackEntry src/memray/_memray.pyx:404>]\r\n\r\n```\r\n\r\nsee also https://github.com/bloomberg/pytest-memray/issues/53\r\n\n", "before_files": [{"content": "from __future__ import annotations\n\nimport os\nimport shutil\nimport subprocess\nimport sys\n\nimport nox\n\nSOURCE_FILES = [\n    \"docs/\",\n    \"dummyserver/\",\n    \"src/\",\n    \"test/\",\n    \"noxfile.py\",\n    \"setup.py\",\n]\n\n\ndef tests_impl(\n    session: nox.Session,\n    extras: str = \"socks,secure,brotli,zstd\",\n    byte_string_comparisons: bool = True,\n) -> None:\n    # Install deps and the package itself.\n    session.install(\"-r\", \"dev-requirements.txt\")\n    session.install(f\".[{extras}]\")\n\n    # Show the pip version.\n    session.run(\"pip\", \"--version\")\n    # Print the Python version and bytesize.\n    session.run(\"python\", \"--version\")\n    session.run(\"python\", \"-c\", \"import struct; print(struct.calcsize('P') * 8)\")\n    # Print OpenSSL information.\n    session.run(\"python\", \"-m\", \"OpenSSL.debug\")\n\n    memray_supported = True\n    if sys.implementation.name != \"cpython\" or sys.version_info < (3, 8):\n        memray_supported = False  # pytest-memray requires CPython 3.8+\n    elif sys.platform == \"win32\":\n        memray_supported = False\n\n    # Inspired from https://hynek.me/articles/ditch-codecov-python/\n    # We use parallel mode and then combine in a later CI step\n    session.run(\n        \"python\",\n        *((\"-bb\",) if byte_string_comparisons else ()),\n        \"-m\",\n        \"coverage\",\n        \"run\",\n        \"--parallel-mode\",\n        \"-m\",\n        \"pytest\",\n        *(\"--memray\", \"--hide-memray-summary\") if memray_supported else (),\n        \"-v\",\n        \"-ra\",\n        f\"--color={'yes' if 'GITHUB_ACTIONS' in os.environ else 'auto'}\",\n        \"--tb=native\",\n        \"--no-success-flaky-report\",\n        \"--durations=10\",\n        \"--strict-config\",\n        \"--strict-markers\",\n        *(session.posargs or (\"test/\",)),\n        env={\"PYTHONWARNINGS\": \"always::DeprecationWarning\"},\n    )\n\n\n@nox.session(python=[\"3.7\", \"3.8\", \"3.9\", \"3.10\", \"3.11\", \"pypy\"])\ndef test(session: nox.Session) -> None:\n    tests_impl(session)\n\n\n@nox.session(python=[\"2.7\"])\ndef unsupported_setup_py(session: nox.Session) -> None:\n    # Can't check both returncode and output with session.run\n    process = subprocess.run(\n        [\"python\", \"setup.py\", \"install\"],\n        env={**session.env},\n        text=True,\n        capture_output=True,\n    )\n    assert process.returncode == 1\n    print(process.stderr)\n    assert \"Please use `python -m pip install .` instead.\" in process.stderr\n\n\n@nox.session(python=[\"3\"])\ndef test_brotlipy(session: nox.Session) -> None:\n    \"\"\"Check that if 'brotlipy' is installed instead of 'brotli' or\n    'brotlicffi' that we still don't blow up.\n    \"\"\"\n    session.install(\"brotlipy\")\n    tests_impl(session, extras=\"socks,secure\", byte_string_comparisons=False)\n\n\ndef git_clone(session: nox.Session, git_url: str) -> None:\n    \"\"\"We either clone the target repository or if already exist\n    simply reset the state and pull.\n    \"\"\"\n    expected_directory = git_url.split(\"/\")[-1]\n\n    if expected_directory.endswith(\".git\"):\n        expected_directory = expected_directory[:-4]\n\n    if not os.path.isdir(expected_directory):\n        session.run(\"git\", \"clone\", \"--depth\", \"1\", git_url, external=True)\n    else:\n        session.run(\n            \"git\", \"-C\", expected_directory, \"reset\", \"--hard\", \"HEAD\", external=True\n        )\n        session.run(\"git\", \"-C\", expected_directory, \"pull\", external=True)\n\n\n@nox.session()\ndef downstream_botocore(session: nox.Session) -> None:\n    root = os.getcwd()\n    tmp_dir = session.create_tmp()\n\n    session.cd(tmp_dir)\n    git_clone(session, \"https://github.com/boto/botocore\")\n    session.chdir(\"botocore\")\n    for patch in [\n        \"0001-Mark-100-Continue-tests-as-failing.patch\",\n        \"0002-Stop-relying-on-removed-DEFAULT_CIPHERS.patch\",\n    ]:\n        session.run(\"git\", \"apply\", f\"{root}/ci/{patch}\", external=True)\n    session.run(\"git\", \"rev-parse\", \"HEAD\", external=True)\n    session.run(\"python\", \"scripts/ci/install\")\n\n    session.cd(root)\n    session.install(\".\", silent=False)\n    session.cd(f\"{tmp_dir}/botocore\")\n\n    session.run(\"python\", \"-c\", \"import urllib3; print(urllib3.__version__)\")\n    session.run(\"python\", \"scripts/ci/run-tests\")\n\n\n@nox.session()\ndef downstream_requests(session: nox.Session) -> None:\n    root = os.getcwd()\n    tmp_dir = session.create_tmp()\n\n    session.cd(tmp_dir)\n    git_clone(session, \"https://github.com/psf/requests\")\n    session.chdir(\"requests\")\n    session.run(\n        \"git\", \"apply\", f\"{root}/ci/0003-requests-removed-warnings.patch\", external=True\n    )\n    session.run(\n        \"git\", \"apply\", f\"{root}/ci/0004-requests-chunked-requests.patch\", external=True\n    )\n    session.run(\"git\", \"rev-parse\", \"HEAD\", external=True)\n    session.install(\".[socks]\", silent=False)\n    session.install(\"-r\", \"requirements-dev.txt\", silent=False)\n\n    session.cd(root)\n    session.install(\".\", silent=False)\n    session.cd(f\"{tmp_dir}/requests\")\n\n    session.run(\"python\", \"-c\", \"import urllib3; print(urllib3.__version__)\")\n    session.run(\"pytest\", \"tests\")\n\n\n@nox.session()\ndef format(session: nox.Session) -> None:\n    \"\"\"Run code formatters.\"\"\"\n    lint(session)\n\n\n@nox.session\ndef lint(session: nox.Session) -> None:\n    session.install(\"pre-commit\")\n    session.run(\"pre-commit\", \"run\", \"--all-files\")\n\n    mypy(session)\n\n\n@nox.session(python=\"3.8\")\ndef mypy(session: nox.Session) -> None:\n    \"\"\"Run mypy.\"\"\"\n    session.install(\"-r\", \"mypy-requirements.txt\")\n    session.run(\"mypy\", \"--version\")\n    session.run(\n        \"mypy\",\n        \"dummyserver\",\n        \"noxfile.py\",\n        \"src/urllib3\",\n        \"test\",\n    )\n\n\n@nox.session\ndef docs(session: nox.Session) -> None:\n    session.install(\"-r\", \"docs/requirements.txt\")\n    session.install(\".[socks,secure,brotli,zstd]\")\n\n    session.chdir(\"docs\")\n    if os.path.exists(\"_build\"):\n        shutil.rmtree(\"_build\")\n    session.run(\"sphinx-build\", \"-b\", \"html\", \"-W\", \".\", \"_build/html\")\n", "path": "noxfile.py"}], "after_files": [{"content": "from __future__ import annotations\n\nimport os\nimport shutil\nimport subprocess\nimport sys\n\nimport nox\n\nSOURCE_FILES = [\n    \"docs/\",\n    \"dummyserver/\",\n    \"src/\",\n    \"test/\",\n    \"noxfile.py\",\n    \"setup.py\",\n]\n\n\ndef tests_impl(\n    session: nox.Session,\n    extras: str = \"socks,secure,brotli,zstd\",\n    byte_string_comparisons: bool = True,\n) -> None:\n    # Install deps and the package itself.\n    session.install(\"-r\", \"dev-requirements.txt\")\n    session.install(f\".[{extras}]\")\n\n    # Show the pip version.\n    session.run(\"pip\", \"--version\")\n    # Print the Python version and bytesize.\n    session.run(\"python\", \"--version\")\n    session.run(\"python\", \"-c\", \"import struct; print(struct.calcsize('P') * 8)\")\n    # Print OpenSSL information.\n    session.run(\"python\", \"-m\", \"OpenSSL.debug\")\n\n    memray_supported = True\n    if sys.implementation.name != \"cpython\" or sys.version_info < (3, 8):\n        memray_supported = False  # pytest-memray requires CPython 3.8+\n    elif sys.platform == \"win32\":\n        memray_supported = False\n\n    # Inspired from https://hynek.me/articles/ditch-codecov-python/\n    # We use parallel mode and then combine in a later CI step\n    session.run(\n        \"python\",\n        *((\"-bb\",) if byte_string_comparisons else ()),\n        \"-m\",\n        \"coverage\",\n        \"run\",\n        \"--parallel-mode\",\n        \"-m\",\n        \"pytest\",\n        *(\"--memray\", \"--hide-memray-summary\") if memray_supported else (),\n        \"-v\",\n        \"-ra\",\n        f\"--color={'yes' if 'GITHUB_ACTIONS' in os.environ else 'auto'}\",\n        \"--tb=native\",\n        \"--durations=10\",\n        \"--strict-config\",\n        \"--strict-markers\",\n        *(session.posargs or (\"test/\",)),\n        env={\"PYTHONWARNINGS\": \"always::DeprecationWarning\"},\n    )\n\n\n@nox.session(python=[\"3.7\", \"3.8\", \"3.9\", \"3.10\", \"3.11\", \"pypy\"])\ndef test(session: nox.Session) -> None:\n    tests_impl(session)\n\n\n@nox.session(python=[\"2.7\"])\ndef unsupported_setup_py(session: nox.Session) -> None:\n    # Can't check both returncode and output with session.run\n    process = subprocess.run(\n        [\"python\", \"setup.py\", \"install\"],\n        env={**session.env},\n        text=True,\n        capture_output=True,\n    )\n    assert process.returncode == 1\n    print(process.stderr)\n    assert \"Please use `python -m pip install .` instead.\" in process.stderr\n\n\n@nox.session(python=[\"3\"])\ndef test_brotlipy(session: nox.Session) -> None:\n    \"\"\"Check that if 'brotlipy' is installed instead of 'brotli' or\n    'brotlicffi' that we still don't blow up.\n    \"\"\"\n    session.install(\"brotlipy\")\n    tests_impl(session, extras=\"socks,secure\", byte_string_comparisons=False)\n\n\ndef git_clone(session: nox.Session, git_url: str) -> None:\n    \"\"\"We either clone the target repository or if already exist\n    simply reset the state and pull.\n    \"\"\"\n    expected_directory = git_url.split(\"/\")[-1]\n\n    if expected_directory.endswith(\".git\"):\n        expected_directory = expected_directory[:-4]\n\n    if not os.path.isdir(expected_directory):\n        session.run(\"git\", \"clone\", \"--depth\", \"1\", git_url, external=True)\n    else:\n        session.run(\n            \"git\", \"-C\", expected_directory, \"reset\", \"--hard\", \"HEAD\", external=True\n        )\n        session.run(\"git\", \"-C\", expected_directory, \"pull\", external=True)\n\n\n@nox.session()\ndef downstream_botocore(session: nox.Session) -> None:\n    root = os.getcwd()\n    tmp_dir = session.create_tmp()\n\n    session.cd(tmp_dir)\n    git_clone(session, \"https://github.com/boto/botocore\")\n    session.chdir(\"botocore\")\n    for patch in [\n        \"0001-Mark-100-Continue-tests-as-failing.patch\",\n        \"0002-Stop-relying-on-removed-DEFAULT_CIPHERS.patch\",\n    ]:\n        session.run(\"git\", \"apply\", f\"{root}/ci/{patch}\", external=True)\n    session.run(\"git\", \"rev-parse\", \"HEAD\", external=True)\n    session.run(\"python\", \"scripts/ci/install\")\n\n    session.cd(root)\n    session.install(\".\", silent=False)\n    session.cd(f\"{tmp_dir}/botocore\")\n\n    session.run(\"python\", \"-c\", \"import urllib3; print(urllib3.__version__)\")\n    session.run(\"python\", \"scripts/ci/run-tests\")\n\n\n@nox.session()\ndef downstream_requests(session: nox.Session) -> None:\n    root = os.getcwd()\n    tmp_dir = session.create_tmp()\n\n    session.cd(tmp_dir)\n    git_clone(session, \"https://github.com/psf/requests\")\n    session.chdir(\"requests\")\n    session.run(\n        \"git\", \"apply\", f\"{root}/ci/0003-requests-removed-warnings.patch\", external=True\n    )\n    session.run(\n        \"git\", \"apply\", f\"{root}/ci/0004-requests-chunked-requests.patch\", external=True\n    )\n    session.run(\"git\", \"rev-parse\", \"HEAD\", external=True)\n    session.install(\".[socks]\", silent=False)\n    session.install(\"-r\", \"requirements-dev.txt\", silent=False)\n\n    session.cd(root)\n    session.install(\".\", silent=False)\n    session.cd(f\"{tmp_dir}/requests\")\n\n    session.run(\"python\", \"-c\", \"import urllib3; print(urllib3.__version__)\")\n    session.run(\"pytest\", \"tests\")\n\n\n@nox.session()\ndef format(session: nox.Session) -> None:\n    \"\"\"Run code formatters.\"\"\"\n    lint(session)\n\n\n@nox.session\ndef lint(session: nox.Session) -> None:\n    session.install(\"pre-commit\")\n    session.run(\"pre-commit\", \"run\", \"--all-files\")\n\n    mypy(session)\n\n\n@nox.session(python=\"3.8\")\ndef mypy(session: nox.Session) -> None:\n    \"\"\"Run mypy.\"\"\"\n    session.install(\"-r\", \"mypy-requirements.txt\")\n    session.run(\"mypy\", \"--version\")\n    session.run(\n        \"mypy\",\n        \"dummyserver\",\n        \"noxfile.py\",\n        \"src/urllib3\",\n        \"test\",\n    )\n\n\n@nox.session\ndef docs(session: nox.Session) -> None:\n    session.install(\"-r\", \"docs/requirements.txt\")\n    session.install(\".[socks,secure,brotli,zstd]\")\n\n    session.chdir(\"docs\")\n    if os.path.exists(\"_build\"):\n        shutil.rmtree(\"_build\")\n    session.run(\"sphinx-build\", \"-b\", \"html\", \"-W\", \".\", \"_build/html\")\n", "path": "noxfile.py"}]}