From 15c4c7b33393eabcd7d3f839777ca890e078a1c8 Mon Sep 17 00:00:00 2001
From: Diego Hurtado <ocelotl@users.noreply.github.com>
Date: Fri, 23 Feb 2024 20:27:28 -0600
Subject: [PATCH] Remove [test] package from requests instrumentation

Fixes #2217
---
 .../pyproject.toml                            |  5 ----
 .../test-requirements.txt                     | 24 +++++++++++++++++++
 tox.ini                                       |  6 ++---
 3 files changed, 27 insertions(+), 8 deletions(-)
 create mode 100644 instrumentation/opentelemetry-instrumentation-requests/test-requirements.txt

diff --git a/instrumentation/opentelemetry-instrumentation-requests/pyproject.toml b/instrumentation/opentelemetry-instrumentation-requests/pyproject.toml
index a4f8255e00..ce83ca93ac 100644
--- a/instrumentation/opentelemetry-instrumentation-requests/pyproject.toml
+++ b/instrumentation/opentelemetry-instrumentation-requests/pyproject.toml
@@ -34,11 +34,6 @@ dependencies = [
 instruments = [
   "requests ~= 2.0",
 ]
-test = [
-  "opentelemetry-instrumentation-requests[instruments]",
-  "httpretty ~= 1.0",
-  "opentelemetry-test-utils == 0.45b0.dev",
-]
 
 [project.entry-points.opentelemetry_instrumentor]
 requests = "opentelemetry.instrumentation.requests:RequestsInstrumentor"
diff --git a/instrumentation/opentelemetry-instrumentation-requests/test-requirements.txt b/instrumentation/opentelemetry-instrumentation-requests/test-requirements.txt
new file mode 100644
index 0000000000..be34594506
--- /dev/null
+++ b/instrumentation/opentelemetry-instrumentation-requests/test-requirements.txt
@@ -0,0 +1,24 @@
+asgiref==3.7.2
+attrs==23.2.0
+certifi==2024.2.2
+charset-normalizer==3.3.2
+Deprecated==1.2.14
+httpretty==1.1.4
+idna==3.6
+importlib-metadata==6.11.0
+iniconfig==2.0.0
+packaging==23.2
+pluggy==1.4.0
+py==1.11.0
+py-cpuinfo==9.0.0
+pytest==7.1.3
+pytest-benchmark==4.0.0
+requests==2.31.0
+tomli==2.0.1
+typing_extensions==4.9.0
+urllib3==2.2.1
+wrapt==1.16.0
+zipp==3.17.0
+-e opentelemetry-instrumentation
+-e util/opentelemetry-util-http
+-e instrumentation/opentelemetry-instrumentation-requests
diff --git a/tox.ini b/tox.ini
index 7b7b2a0710..c4f3d7001e 100644
--- a/tox.ini
+++ b/tox.ini
@@ -333,7 +333,7 @@ commands_pre =
 
   grpc: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-grpc[test]
 
-  falcon-{1,2,3},flask-{213,220,300},django-{1,2,3,4},pyramid,tornado,starlette,fastapi,aiohttp,asgi,httpx-{18,21},requests,urllib,urllib3v-{1,2},wsgi: pip install {toxinidir}/util/opentelemetry-util-http
+  falcon-{1,2,3},flask-{213,220,300},django-{1,2,3,4},pyramid,tornado,starlette,fastapi,aiohttp,asgi,httpx-{18,21},urllib,urllib3v-{1,2},wsgi: pip install {toxinidir}/util/opentelemetry-util-http
   wsgi,falcon-{1,2,3},flask-{213,220,300},django-{1,2,3,4},pyramid: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-wsgi[test]
   asgi,django-{3,4},starlette,fastapi: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-asgi[test]
 
@@ -386,7 +386,7 @@ commands_pre =
 
   remoulade: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-remoulade[test]
 
-  requests: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-requests[test]
+  requests: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-requests/test-requirements.txt
 
   starlette: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-starlette[test]
 
@@ -566,7 +566,7 @@ commands_pre =
   python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-aiopg[test]
   python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-sqlite3[test]
   python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-pyramid[test]
-  python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-requests[test]
+  pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-requests/test-requirements.txt
   python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-urllib[test]
   python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-urllib3[test]
   python -m pip install -e {toxinidir}/instrumentation/opentelemetry-instrumentation-pymysql[test]