From 79855af2b62223c53049fead62706255b45ce48c Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Tue, 30 Jan 2024 14:14:27 +0100 Subject: [PATCH 01/60] Remove outdated pins --- test-requirements.txt | 2 +- tox.ini | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index c9324e753b..9c847e2ca3 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -3,7 +3,7 @@ mock ; python_version<'3.3' pytest pytest-cov==2.8.1 pytest-forked<=1.4.0 -pytest-localserver==0.5.1 # TODO(py3): 0.6.0 drops 2.7 support: https://github.com/pytest-dev/pytest-localserver/releases/tag/v0.6.0 +pytest-localserver pytest-watch==4.2.0 tox==3.7.0 jsonschema==3.2.0 diff --git a/tox.ini b/tox.ini index 0be7733f67..cd82e2da47 100644 --- a/tox.ini +++ b/tox.ini @@ -638,11 +638,8 @@ basepython = commands = {py3.7,py3.8}-boto3: pip install urllib3<2.0.0 - ; https://github.com/pytest-dev/pytest/issues/5532 - {py3.6,py3.7,py3.8,py3.9}-flask-v{0.11,0.12}: pip install pytest<5 - {py3.6,py3.7,py3.8,py3.9}-flask-v{0.11}: pip install Werkzeug<2 ; https://github.com/pallets/flask/issues/4455 - {py3.7,py3.8,py3.9,py3.10,py3.11}-flask-v{0.11,0.12,1.0,1.1}: pip install "itsdangerous>=0.24,<2.0" "markupsafe<2.0.0" "jinja2<3.1.1" + {py3.7,py3.8,py3.9,py3.10,py3.11}-flask-v{1}: pip install "itsdangerous>=0.24,<2.0" "markupsafe<2.0.0" "jinja2<3.1.1" ; Running `py.test` as an executable suffers from an import error ; when loading tests in scenarios. In particular, django fails to From fd3ed36b8c44d883e8ed080651f253b6a3c244a7 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Tue, 30 Jan 2024 14:23:32 +0100 Subject: [PATCH 02/60] Remove more pins --- test-requirements.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index 9c847e2ca3..8e6b29f5d7 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,5 +1,4 @@ pip # always use newest pip -mock ; python_version<'3.3' pytest pytest-cov==2.8.1 pytest-forked<=1.4.0 @@ -7,8 +6,8 @@ pytest-localserver pytest-watch==4.2.0 tox==3.7.0 jsonschema==3.2.0 -pyrsistent==0.16.0 # TODO(py3): 0.17.0 requires python3, see https://github.com/tobgu/pyrsistent/issues/205 -executing<2.0.0 # TODO(py3): 2.0.0 requires python3 +pyrsistent +executing asttokens responses pysocks From 4a0b04e37416cf816f040137148b07e677fc0fbc Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Tue, 30 Jan 2024 14:29:22 +0100 Subject: [PATCH 03/60] more pins --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 8e6b29f5d7..293251adb6 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,7 +1,7 @@ pip # always use newest pip pytest pytest-cov==2.8.1 -pytest-forked<=1.4.0 +pytest-forked pytest-localserver pytest-watch==4.2.0 tox==3.7.0 From 9c4c48acd6a579f19182fbcf5efa9c85a272674c Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Tue, 30 Jan 2024 14:40:27 +0100 Subject: [PATCH 04/60] remove all the pins! --- test-requirements.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index 293251adb6..8d6791c464 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,11 +1,11 @@ -pip # always use newest pip +pip pytest -pytest-cov==2.8.1 +pytest-cov pytest-forked pytest-localserver -pytest-watch==4.2.0 -tox==3.7.0 -jsonschema==3.2.0 +pytest-watch +tox +jsonschema pyrsistent executing asttokens From 0f722231896838ae77ea6efa2dd5834215f5861d Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Tue, 30 Jan 2024 14:42:36 +0100 Subject: [PATCH 05/60] ok not all at once --- test-requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index 8d6791c464..f6949a2729 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -3,9 +3,9 @@ pytest pytest-cov pytest-forked pytest-localserver -pytest-watch +pytest-watch==4.2.0 tox -jsonschema +jsonschema==3.2.0 pyrsistent executing asttokens From 5427ea3743925081ce34e944cad49567cceae735 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Tue, 30 Jan 2024 14:47:38 +0100 Subject: [PATCH 06/60] lets start with tox --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index f6949a2729..a26f37ce60 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,6 +1,6 @@ pip pytest -pytest-cov +pytest-cov==2.8.1 pytest-forked pytest-localserver pytest-watch==4.2.0 From 336f2608bf114f862dc87a9c2fd64e50dd16e4b7 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Tue, 30 Jan 2024 15:06:41 +0100 Subject: [PATCH 07/60] ok not touching tox yet --- test-requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index a26f37ce60..2cd8776176 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -3,8 +3,8 @@ pytest pytest-cov==2.8.1 pytest-forked pytest-localserver -pytest-watch==4.2.0 -tox +pytest-watch +tox==3.7.0 jsonschema==3.2.0 pyrsistent executing From 9d9898fb81956f50fa67968fa949a03a65d09f1e Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Tue, 6 Feb 2024 14:54:19 +0100 Subject: [PATCH 08/60] drop jsonschema pin --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 2cd8776176..deaf6b3c63 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -5,7 +5,7 @@ pytest-forked pytest-localserver pytest-watch tox==3.7.0 -jsonschema==3.2.0 +jsonschema pyrsistent executing asttokens From 050f97b78de1245a7faff206484effab23f82f03 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Tue, 6 Feb 2024 15:01:37 +0100 Subject: [PATCH 09/60] bisecting.. --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index deaf6b3c63..97f1e5323c 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -5,7 +5,7 @@ pytest-forked pytest-localserver pytest-watch tox==3.7.0 -jsonschema +jsonschema==4.0.1 pyrsistent executing asttokens From 6e9c8bf9bf6bea8b97fe2b8113f52f5a10388c09 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Tue, 6 Feb 2024 16:30:19 +0100 Subject: [PATCH 10/60] fix new beam --- test-requirements.txt | 2 +- tests/integrations/beam/test_beam.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index 97f1e5323c..deaf6b3c63 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -5,7 +5,7 @@ pytest-forked pytest-localserver pytest-watch tox==3.7.0 -jsonschema==4.0.1 +jsonschema pyrsistent executing asttokens diff --git a/tests/integrations/beam/test_beam.py b/tests/integrations/beam/test_beam.py index 7926521ca6..d14c8a23e8 100644 --- a/tests/integrations/beam/test_beam.py +++ b/tests/integrations/beam/test_beam.py @@ -182,7 +182,11 @@ def inner(fn): signature = pardo._signature output_processor = _OutputHandler() return DoFnInvoker.create_invoker( - signature, output_processor, DoFnContext("test") + signature, + output_processor, + DoFnContext("test"), + input_args=[], + input_kwargs={}, ) return inner From 7d64ad127c3a256a2ea7591c03b0db79db795567 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Tue, 6 Feb 2024 16:32:51 +0100 Subject: [PATCH 11/60] remove pin on pytest-cov --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index deaf6b3c63..c421f85c4b 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,6 +1,6 @@ pip pytest -pytest-cov==2.8.1 +pytest-cov pytest-forked pytest-localserver pytest-watch From b99c87680b4747af527ecefca4d8a2ab50492211 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Tue, 6 Feb 2024 16:43:15 +0100 Subject: [PATCH 12/60] tox step by step --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index c421f85c4b..29125842cb 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,7 +4,7 @@ pytest-cov pytest-forked pytest-localserver pytest-watch -tox==3.7.0 +tox<4 jsonschema pyrsistent executing From 1c2700cb300e8d036d26fa3515cb68c69deda717 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Tue, 6 Feb 2024 16:51:25 +0100 Subject: [PATCH 13/60] pytest deprecation --- tests/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/__init__.py b/tests/__init__.py index cac15f9333..8a5dfaec96 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,7 +1,6 @@ +import warnings import sys -import pytest - # This is used in _capture_internal_warnings. We need to run this at import # time because that's where many deprecation warnings might get thrown. # @@ -9,5 +8,5 @@ # gets loaded too late. assert "sentry_sdk" not in sys.modules -_warning_recorder_mgr = pytest.warns(None) +_warning_recorder_mgr = warnings.catch_warnings(record=True) _warning_recorder = _warning_recorder_mgr.__enter__() From 6659e97cca06a7f930774abcb7de6897f02898b6 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Tue, 6 Feb 2024 17:07:49 +0100 Subject: [PATCH 14/60] no distutils on 3.12 --- tests/integrations/rq/test_rq.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/integrations/rq/test_rq.py b/tests/integrations/rq/test_rq.py index 3f2218c945..7725b80f78 100644 --- a/tests/integrations/rq/test_rq.py +++ b/tests/integrations/rq/test_rq.py @@ -16,8 +16,10 @@ def _patch_rq_get_server_version(monkeypatch): https://github.com/jamesls/fakeredis/issues/273 """ - - from distutils.version import StrictVersion + try: + from distutils.version import StrictVersion + except ImportError: + return if parse_version(rq.VERSION) <= (1, 5, 1): for k in ( From 0953fa7b2456ce398056fb28f5e7eea7e530f2ba Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Tue, 6 Feb 2024 17:45:48 +0100 Subject: [PATCH 15/60] add setuptools, fix pytest for redis --- test-requirements.txt | 1 + tox.ini | 1 + 2 files changed, 2 insertions(+) diff --git a/test-requirements.txt b/test-requirements.txt index 29125842cb..9f20d2db79 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -12,3 +12,4 @@ asttokens responses pysocks ipdb +setuptools diff --git a/tox.ini b/tox.ini index cd82e2da47..2f5aabe7b4 100644 --- a/tox.ini +++ b/tox.ini @@ -464,6 +464,7 @@ deps = # Redis redis: fakeredis!=1.7.4 + redis: pytest<8.0.0 {py3.7,py3.8,py3.9,py3.10,py3.11}-redis: pytest-asyncio<=0.21.1 redis-v3: redis~=3.0 redis-v4: redis~=4.0 From 66d46d51fb64e28a537b8e71f2bfc7b20788fe00 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Tue, 6 Feb 2024 17:53:58 +0100 Subject: [PATCH 16/60] again --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 9f20d2db79..174d45f3c2 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,7 +4,7 @@ pytest-cov pytest-forked pytest-localserver pytest-watch -tox<4 +tox jsonschema pyrsistent executing From f3fed1294a1ca8063641e6bd54644264ef268c12 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Tue, 6 Feb 2024 17:57:44 +0100 Subject: [PATCH 17/60] ? --- tests/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/__init__.py b/tests/__init__.py index 8a5dfaec96..2e4df719d5 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,5 +1,5 @@ -import warnings import sys +import warnings # This is used in _capture_internal_warnings. We need to run this at import # time because that's where many deprecation warnings might get thrown. From 56cc583b5c3374c3343a0579ee195a1b2725c41f Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Wed, 3 Apr 2024 14:03:14 +0200 Subject: [PATCH 18/60] compat import not needed anymore --- tests/integrations/django/myapp/settings.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/tests/integrations/django/myapp/settings.py b/tests/integrations/django/myapp/settings.py index ac06d9204e..721cef0984 100644 --- a/tests/integrations/django/myapp/settings.py +++ b/tests/integrations/django/myapp/settings.py @@ -17,16 +17,9 @@ sentry_sdk.init(integrations=[DjangoIntegration()]) - import os -try: - # Django >= 1.10 - from django.utils.deprecation import MiddlewareMixin -except ImportError: - # Not required for Django <= 1.9, see: - # https://docs.djangoproject.com/en/1.10/topics/http/middleware/#upgrading-pre-django-1-10-style-middleware - MiddlewareMixin = object +from django.utils.deprecation import MiddlewareMixin # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) From 214b210fa380b3b276179a6e097fb08a6e7d8b7e Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Wed, 3 Apr 2024 16:47:07 +0200 Subject: [PATCH 19/60] is it tox? --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 174d45f3c2..9fa5b9a4b5 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,7 +4,7 @@ pytest-cov pytest-forked pytest-localserver pytest-watch -tox +tox==3.7.0 jsonschema pyrsistent executing From 87f6118db7ac0e8d984b104d31c430c56ab72bc3 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Wed, 3 Apr 2024 16:50:15 +0200 Subject: [PATCH 20/60] is it tox<4? --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 9fa5b9a4b5..9f20d2db79 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,7 +4,7 @@ pytest-cov pytest-forked pytest-localserver pytest-watch -tox==3.7.0 +tox<4 jsonschema pyrsistent executing From b7134508d92a59b83ee25a039f4edad201006c46 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Wed, 3 Apr 2024 16:55:35 +0200 Subject: [PATCH 21/60] is it tox 4? --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 9f20d2db79..494ddcb129 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,7 +4,7 @@ pytest-cov pytest-forked pytest-localserver pytest-watch -tox<4 +tox==4.0.0 jsonschema pyrsistent executing From e26b1c272a3eb01e980d56c45ceb8a6970ef0b51 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Wed, 3 Apr 2024 17:01:28 +0200 Subject: [PATCH 22/60] tox 4.0.19? --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 494ddcb129..3679feba9b 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,7 +4,7 @@ pytest-cov pytest-forked pytest-localserver pytest-watch -tox==4.0.0 +tox==4.0.19 jsonschema pyrsistent executing From 0d0b5dcf3f13d2b60eaf7e18cf6cc001cccb6cf5 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Wed, 3 Apr 2024 17:15:35 +0200 Subject: [PATCH 23/60] sad --- test-requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 3679feba9b..74b3b6e761 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,7 +4,8 @@ pytest-cov pytest-forked pytest-localserver pytest-watch -tox==4.0.19 +tox; python_version < '3.12' +tox<4; python_version >= '3.12' jsonschema pyrsistent executing From 6ac9dc05821e72f28e4571a731f5ce595ef1d875 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Wed, 3 Apr 2024 17:20:34 +0200 Subject: [PATCH 24/60] add comment --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 74b3b6e761..ae6a61d2b9 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -5,7 +5,7 @@ pytest-forked pytest-localserver pytest-watch tox; python_version < '3.12' -tox<4; python_version >= '3.12' +tox<4; python_version >= '3.12' # TODO: >=4 makes async django tests hang in CI jsonschema pyrsistent executing From a1eaf1d666253add58f316c24acc1aa762a9b57e Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Thu, 4 Apr 2024 10:11:03 +0200 Subject: [PATCH 25/60] formatting --- test-requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index ae6a61d2b9..ea30e06e0c 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,8 +4,8 @@ pytest-cov pytest-forked pytest-localserver pytest-watch -tox; python_version < '3.12' -tox<4; python_version >= '3.12' # TODO: >=4 makes async django tests hang in CI +tox; python_version<'3.12' +tox<4; python_version>='3.12' # TODO: >=4 makes async django tests hang in CI jsonschema pyrsistent executing From f0989b80da1ecb247f580bb8cbaf93be6ddcb211 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Thu, 4 Apr 2024 10:15:17 +0200 Subject: [PATCH 26/60] trying somethin --- tests/integrations/django/asgi/test_asgi.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/integrations/django/asgi/test_asgi.py b/tests/integrations/django/asgi/test_asgi.py index 87c85109ef..d143dd7136 100644 --- a/tests/integrations/django/asgi/test_asgi.py +++ b/tests/integrations/django/asgi/test_asgi.py @@ -25,7 +25,6 @@ @pytest.mark.parametrize("application", APPS) @pytest.mark.asyncio -@pytest.mark.forked async def test_basic(sentry_init, capture_events, application): sentry_init(integrations=[DjangoIntegration()], send_default_pii=True) From b6b8627559ffea135b600a1dddad3facf9b89c24 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Thu, 4 Apr 2024 10:15:36 +0200 Subject: [PATCH 27/60] wip --- test-requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index ea30e06e0c..c1175b05c8 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,8 +4,8 @@ pytest-cov pytest-forked pytest-localserver pytest-watch -tox; python_version<'3.12' -tox<4; python_version>='3.12' # TODO: >=4 makes async django tests hang in CI +tox#; python_version<'3.12' +#tox<4; python_version>='3.12' # TODO: >=4 makes async django tests hang in CI jsonschema pyrsistent executing From 07549e9cd644731fe5533bbd8419717f12bc7e79 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Thu, 4 Apr 2024 10:16:43 +0200 Subject: [PATCH 28/60] wip --- test-requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index c1175b05c8..0798db0571 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,7 +4,8 @@ pytest-cov pytest-forked pytest-localserver pytest-watch -tox#; python_version<'3.12' +tox +#tox; python_version<'3.12' #tox<4; python_version>='3.12' # TODO: >=4 makes async django tests hang in CI jsonschema pyrsistent From dc8dc524b313ac77064b3854b7ec40bbcc16104b Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Thu, 4 Apr 2024 12:16:24 +0200 Subject: [PATCH 29/60] change tox pin in ci yamls --- .github/workflows/test-integrations-aws-lambda.yml | 2 +- .github/workflows/test-integrations-cloud-computing.yml | 4 ++-- .github/workflows/test-integrations-common.yml | 2 +- .github/workflows/test-integrations-data-processing.yml | 4 ++-- .github/workflows/test-integrations-databases.yml | 4 ++-- .github/workflows/test-integrations-graphql.yml | 4 ++-- .github/workflows/test-integrations-miscellaneous.yml | 4 ++-- .github/workflows/test-integrations-networking.yml | 4 ++-- .github/workflows/test-integrations-web-frameworks-1.yml | 4 ++-- .github/workflows/test-integrations-web-frameworks-2.yml | 4 ++-- scripts/split-tox-gh-actions/templates/test_group.jinja | 2 +- 11 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/test-integrations-aws-lambda.yml b/.github/workflows/test-integrations-aws-lambda.yml index 7b59c7632a..b8a453b50f 100644 --- a/.github/workflows/test-integrations-aws-lambda.yml +++ b/.github/workflows/test-integrations-aws-lambda.yml @@ -73,7 +73,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Setup Test Env run: | - pip install coverage "tox>=3,<4" + pip install coverage tox - name: Erase coverage run: | coverage erase diff --git a/.github/workflows/test-integrations-cloud-computing.yml b/.github/workflows/test-integrations-cloud-computing.yml index d56d3969ab..62bdbcf6f5 100644 --- a/.github/workflows/test-integrations-cloud-computing.yml +++ b/.github/workflows/test-integrations-cloud-computing.yml @@ -38,7 +38,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Setup Test Env run: | - pip install coverage "tox>=3,<4" + pip install coverage tox - name: Erase coverage run: | coverage erase @@ -86,7 +86,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Setup Test Env run: | - pip install coverage "tox>=3,<4" + pip install coverage tox - name: Erase coverage run: | coverage erase diff --git a/.github/workflows/test-integrations-common.yml b/.github/workflows/test-integrations-common.yml index 4945bfec5f..c15446533b 100644 --- a/.github/workflows/test-integrations-common.yml +++ b/.github/workflows/test-integrations-common.yml @@ -38,7 +38,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Setup Test Env run: | - pip install coverage "tox>=3,<4" + pip install coverage tox - name: Erase coverage run: | coverage erase diff --git a/.github/workflows/test-integrations-data-processing.yml b/.github/workflows/test-integrations-data-processing.yml index ed2e261d07..51cd986736 100644 --- a/.github/workflows/test-integrations-data-processing.yml +++ b/.github/workflows/test-integrations-data-processing.yml @@ -38,7 +38,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Setup Test Env run: | - pip install coverage "tox>=3,<4" + pip install coverage tox - name: Erase coverage run: | coverage erase @@ -94,7 +94,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Setup Test Env run: | - pip install coverage "tox>=3,<4" + pip install coverage tox - name: Erase coverage run: | coverage erase diff --git a/.github/workflows/test-integrations-databases.yml b/.github/workflows/test-integrations-databases.yml index 7bfbd22725..3e7f5bfb4f 100644 --- a/.github/workflows/test-integrations-databases.yml +++ b/.github/workflows/test-integrations-databases.yml @@ -58,7 +58,7 @@ jobs: - uses: getsentry/action-clickhouse-in-ci@v1 - name: Setup Test Env run: | - pip install coverage "tox>=3,<4" + pip install coverage tox psql postgresql://postgres:sentry@localhost:5432 -c "create database ${SENTRY_PYTHON_TEST_POSTGRES_NAME};" || true psql postgresql://postgres:sentry@localhost:5432 -c "grant all privileges on database ${SENTRY_PYTHON_TEST_POSTGRES_NAME} to ${SENTRY_PYTHON_TEST_POSTGRES_USER};" || true - name: Erase coverage @@ -136,7 +136,7 @@ jobs: - uses: getsentry/action-clickhouse-in-ci@v1 - name: Setup Test Env run: | - pip install coverage "tox>=3,<4" + pip install coverage tox psql postgresql://postgres:sentry@localhost:5432 -c "create database ${SENTRY_PYTHON_TEST_POSTGRES_NAME};" || true psql postgresql://postgres:sentry@localhost:5432 -c "grant all privileges on database ${SENTRY_PYTHON_TEST_POSTGRES_NAME} to ${SENTRY_PYTHON_TEST_POSTGRES_USER};" || true - name: Erase coverage diff --git a/.github/workflows/test-integrations-graphql.yml b/.github/workflows/test-integrations-graphql.yml index 5595437fa7..ffad9d78df 100644 --- a/.github/workflows/test-integrations-graphql.yml +++ b/.github/workflows/test-integrations-graphql.yml @@ -38,7 +38,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Setup Test Env run: | - pip install coverage "tox>=3,<4" + pip install coverage tox - name: Erase coverage run: | coverage erase @@ -86,7 +86,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Setup Test Env run: | - pip install coverage "tox>=3,<4" + pip install coverage tox - name: Erase coverage run: | coverage erase diff --git a/.github/workflows/test-integrations-miscellaneous.yml b/.github/workflows/test-integrations-miscellaneous.yml index 537730220e..c8bae41e26 100644 --- a/.github/workflows/test-integrations-miscellaneous.yml +++ b/.github/workflows/test-integrations-miscellaneous.yml @@ -38,7 +38,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Setup Test Env run: | - pip install coverage "tox>=3,<4" + pip install coverage tox - name: Erase coverage run: | coverage erase @@ -86,7 +86,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Setup Test Env run: | - pip install coverage "tox>=3,<4" + pip install coverage tox - name: Erase coverage run: | coverage erase diff --git a/.github/workflows/test-integrations-networking.yml b/.github/workflows/test-integrations-networking.yml index 9f5c70ddda..51837cc73b 100644 --- a/.github/workflows/test-integrations-networking.yml +++ b/.github/workflows/test-integrations-networking.yml @@ -38,7 +38,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Setup Test Env run: | - pip install coverage "tox>=3,<4" + pip install coverage tox - name: Erase coverage run: | coverage erase @@ -86,7 +86,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Setup Test Env run: | - pip install coverage "tox>=3,<4" + pip install coverage tox - name: Erase coverage run: | coverage erase diff --git a/.github/workflows/test-integrations-web-frameworks-1.yml b/.github/workflows/test-integrations-web-frameworks-1.yml index 9a0fd351cd..4a8f9140bc 100644 --- a/.github/workflows/test-integrations-web-frameworks-1.yml +++ b/.github/workflows/test-integrations-web-frameworks-1.yml @@ -57,7 +57,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Setup Test Env run: | - pip install coverage "tox>=3,<4" + pip install coverage tox psql postgresql://postgres:sentry@localhost:5432 -c "create database ${SENTRY_PYTHON_TEST_POSTGRES_NAME};" || true psql postgresql://postgres:sentry@localhost:5432 -c "grant all privileges on database ${SENTRY_PYTHON_TEST_POSTGRES_NAME} to ${SENTRY_PYTHON_TEST_POSTGRES_USER};" || true - name: Erase coverage @@ -126,7 +126,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Setup Test Env run: | - pip install coverage "tox>=3,<4" + pip install coverage tox psql postgresql://postgres:sentry@localhost:5432 -c "create database ${SENTRY_PYTHON_TEST_POSTGRES_NAME};" || true psql postgresql://postgres:sentry@localhost:5432 -c "grant all privileges on database ${SENTRY_PYTHON_TEST_POSTGRES_NAME} to ${SENTRY_PYTHON_TEST_POSTGRES_USER};" || true - name: Erase coverage diff --git a/.github/workflows/test-integrations-web-frameworks-2.yml b/.github/workflows/test-integrations-web-frameworks-2.yml index 7b71959fb2..4222c8b501 100644 --- a/.github/workflows/test-integrations-web-frameworks-2.yml +++ b/.github/workflows/test-integrations-web-frameworks-2.yml @@ -38,7 +38,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Setup Test Env run: | - pip install coverage "tox>=3,<4" + pip install coverage tox - name: Erase coverage run: | coverage erase @@ -106,7 +106,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Setup Test Env run: | - pip install coverage "tox>=3,<4" + pip install coverage tox - name: Erase coverage run: | coverage erase diff --git a/scripts/split-tox-gh-actions/templates/test_group.jinja b/scripts/split-tox-gh-actions/templates/test_group.jinja index c40d5eaa5f..58692d99d0 100644 --- a/scripts/split-tox-gh-actions/templates/test_group.jinja +++ b/scripts/split-tox-gh-actions/templates/test_group.jinja @@ -55,7 +55,7 @@ - name: Setup Test Env run: | - pip install coverage "tox>=3,<4" + pip install coverage tox {% if needs_postgres %} psql postgresql://postgres:sentry@localhost:5432 -c "create database ${SENTRY_PYTHON_TEST_POSTGRES_NAME};" || true psql postgresql://postgres:sentry@localhost:5432 -c "grant all privileges on database ${SENTRY_PYTHON_TEST_POSTGRES_NAME} to ${SENTRY_PYTHON_TEST_POSTGRES_USER};" || true From 62a2366279332eba0efa8d78916791731dbd13e4 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Thu, 4 Apr 2024 12:21:11 +0200 Subject: [PATCH 30/60] return the fork --- tests/integrations/django/asgi/test_asgi.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/integrations/django/asgi/test_asgi.py b/tests/integrations/django/asgi/test_asgi.py index d143dd7136..87c85109ef 100644 --- a/tests/integrations/django/asgi/test_asgi.py +++ b/tests/integrations/django/asgi/test_asgi.py @@ -25,6 +25,7 @@ @pytest.mark.parametrize("application", APPS) @pytest.mark.asyncio +@pytest.mark.forked async def test_basic(sentry_init, capture_events, application): sentry_init(integrations=[DjangoIntegration()], send_default_pii=True) From affe24ba449fbe1424b50333b06332dcab48c09c Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Thu, 4 Apr 2024 12:23:27 +0200 Subject: [PATCH 31/60] remove dependabot ignores --- .github/dependabot.yml | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d375588780..2b91d51cc0 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,27 +9,9 @@ updates: - dependency-type: direct - dependency-type: indirect ignore: - - dependency-name: pytest - versions: - - "> 3.7.3" - - dependency-name: flake8 # Later versions dropped Python 2 support - versions: - - "> 5.0.4" - - dependency-name: jsonschema # Later versions dropped Python 2 support - versions: - - "> 3.2.0" - - dependency-name: pytest-cov - versions: - - "> 2.8.1" - - dependency-name: pytest-forked - versions: - - "> 1.1.3" - dependency-name: sphinx versions: - ">= 2.4.a, < 2.5" - - dependency-name: tox - versions: - - "> 3.7.0" - dependency-name: werkzeug versions: - "> 0.15.5, < 1" From 0f60c5b17086173a4d83b14e78afeee7d981670e Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Thu, 4 Apr 2024 14:25:37 +0200 Subject: [PATCH 32/60] trying somethin --- scripts/runtox.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/runtox.sh b/scripts/runtox.sh index dbbb4f2e10..50da44dd53 100755 --- a/scripts/runtox.sh +++ b/scripts/runtox.sh @@ -40,4 +40,4 @@ if [ -z "${ENV}" ]; then exit 0 fi -exec $TOXPATH -vv -e "$ENV" -- "${@:2}" +exec $TOXPATH -e "$ENV" -- "${@:2}" From d49324eb1beee5623a77048ddf401b8bb1b2fc6d Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Thu, 4 Apr 2024 14:44:19 +0200 Subject: [PATCH 33/60] wip --- tests/integrations/django/test_basic.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/integrations/django/test_basic.py b/tests/integrations/django/test_basic.py index 083add6b6e..2ebd57fa0a 100644 --- a/tests/integrations/django/test_basic.py +++ b/tests/integrations/django/test_basic.py @@ -275,7 +275,7 @@ def test_trace_from_headers_if_performance_disabled( @pytest.mark.forked -@pytest.mark.django_db +@pytest_mark_django_db_decorator() def test_user_captured(sentry_init, client, capture_events): sentry_init(integrations=[DjangoIntegration()], send_default_pii=True) events = capture_events() @@ -297,7 +297,7 @@ def test_user_captured(sentry_init, client, capture_events): @pytest.mark.forked -@pytest.mark.django_db +@pytest_mark_django_db_decorator() def test_queryset_repr(sentry_init, capture_events): sentry_init(integrations=[DjangoIntegration()]) events = capture_events() @@ -358,7 +358,7 @@ def test_management_command_raises(): @pytest.mark.forked -@pytest.mark.django_db +@pytest_mark_django_db_decorator() @pytest.mark.parametrize("with_integration", [True, False]) def test_sql_queries(sentry_init, capture_events, with_integration): sentry_init( From 8d8e12a67ce1c4dd28ea60467849536bcd1b3ae5 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Thu, 4 Apr 2024 17:07:42 +0200 Subject: [PATCH 34/60] try bumping protobuf types --- linter-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linter-requirements.txt b/linter-requirements.txt index c390f5fe70..289df0cd7f 100644 --- a/linter-requirements.txt +++ b/linter-requirements.txt @@ -2,7 +2,7 @@ mypy black flake8==5.0.4 # flake8 depends on pyflakes>=3.0.0 and this dropped support for Python 2 "# type:" comments types-certifi -types-protobuf==4.24.0.20240311 # newer raises an error on mypy sentry_sdk +types-protobuf types-redis types-setuptools pymongo # There is no separate types module. From 59401e5af4ae0e91b35a4220adadcc54de4790de Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Fri, 5 Apr 2024 10:50:58 +0200 Subject: [PATCH 35/60] make tox verbose again --- scripts/runtox.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/runtox.sh b/scripts/runtox.sh index 50da44dd53..dbbb4f2e10 100755 --- a/scripts/runtox.sh +++ b/scripts/runtox.sh @@ -40,4 +40,4 @@ if [ -z "${ENV}" ]; then exit 0 fi -exec $TOXPATH -e "$ENV" -- "${@:2}" +exec $TOXPATH -vv -e "$ENV" -- "${@:2}" From e81c1e99c82b43710dd4c3f34d4342f37b566bd3 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Fri, 5 Apr 2024 11:13:52 +0200 Subject: [PATCH 36/60] trying something --- tests/integrations/sqlalchemy/test_sqlalchemy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integrations/sqlalchemy/test_sqlalchemy.py b/tests/integrations/sqlalchemy/test_sqlalchemy.py index e11b59c630..3a4135ccb8 100644 --- a/tests/integrations/sqlalchemy/test_sqlalchemy.py +++ b/tests/integrations/sqlalchemy/test_sqlalchemy.py @@ -234,7 +234,7 @@ def processor(event, hint): event["message"] = long_str return event - engine = create_engine("sqlite:///:memory:") + engine = create_engine("sqlite:///:memory:?check_same_thread=false") with start_transaction(name="test"): with engine.connect() as con: for _ in range(1500): From 5d3f511df0b4d91ee8b82d597709a11124ef7cdd Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Fri, 5 Apr 2024 11:20:46 +0200 Subject: [PATCH 37/60] another attempt --- tests/integrations/sqlalchemy/test_sqlalchemy.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/integrations/sqlalchemy/test_sqlalchemy.py b/tests/integrations/sqlalchemy/test_sqlalchemy.py index 3a4135ccb8..22ea697152 100644 --- a/tests/integrations/sqlalchemy/test_sqlalchemy.py +++ b/tests/integrations/sqlalchemy/test_sqlalchemy.py @@ -234,7 +234,9 @@ def processor(event, hint): event["message"] = long_str return event - engine = create_engine("sqlite:///:memory:?check_same_thread=false") + engine = create_engine( + "sqlite:///:memory:", connect_args={"check_same_thread": False} + ) with start_transaction(name="test"): with engine.connect() as con: for _ in range(1500): From 0f146addb6e3e18635d11bce644a14cd6d8daace Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Fri, 5 Apr 2024 11:25:34 +0200 Subject: [PATCH 38/60] ? --- tests/integrations/sqlalchemy/test_sqlalchemy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integrations/sqlalchemy/test_sqlalchemy.py b/tests/integrations/sqlalchemy/test_sqlalchemy.py index 22ea697152..a3fe332575 100644 --- a/tests/integrations/sqlalchemy/test_sqlalchemy.py +++ b/tests/integrations/sqlalchemy/test_sqlalchemy.py @@ -238,7 +238,7 @@ def processor(event, hint): "sqlite:///:memory:", connect_args={"check_same_thread": False} ) with start_transaction(name="test"): - with engine.connect() as con: + with engine.connect(check_same_thread=False) as con: for _ in range(1500): con.execute( text(" UNION ".join("SELECT {}".format(i) for i in range(100))) From db5e3f11300913e73ce60c8b6916855006d4e1c8 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Fri, 5 Apr 2024 11:30:50 +0200 Subject: [PATCH 39/60] revert --- tests/integrations/sqlalchemy/test_sqlalchemy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integrations/sqlalchemy/test_sqlalchemy.py b/tests/integrations/sqlalchemy/test_sqlalchemy.py index a3fe332575..22ea697152 100644 --- a/tests/integrations/sqlalchemy/test_sqlalchemy.py +++ b/tests/integrations/sqlalchemy/test_sqlalchemy.py @@ -238,7 +238,7 @@ def processor(event, hint): "sqlite:///:memory:", connect_args={"check_same_thread": False} ) with start_transaction(name="test"): - with engine.connect(check_same_thread=False) as con: + with engine.connect() as con: for _ in range(1500): con.execute( text(" UNION ".join("SELECT {}".format(i) for i in range(100))) From 63bf914afbaa7bf26d57088bee99d74737ed50ac Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Fri, 5 Apr 2024 11:35:21 +0200 Subject: [PATCH 40/60] is this coming from elsewhere? --- .../sqlalchemy/test_sqlalchemy.py | 44 ++++++++++++++----- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/tests/integrations/sqlalchemy/test_sqlalchemy.py b/tests/integrations/sqlalchemy/test_sqlalchemy.py index 22ea697152..99d6a5c5fc 100644 --- a/tests/integrations/sqlalchemy/test_sqlalchemy.py +++ b/tests/integrations/sqlalchemy/test_sqlalchemy.py @@ -40,7 +40,9 @@ class Address(Base): person_id = Column(Integer, ForeignKey("person.id")) person = relationship(Person) - engine = create_engine("sqlite:///:memory:") + engine = create_engine( + "sqlite:///:memory:", connect_args={"check_same_thread": False} + ) Base.metadata.create_all(engine) Session = sessionmaker(bind=engine) # noqa: N806 @@ -100,7 +102,9 @@ class Address(Base): person_id = Column(Integer, ForeignKey("person.id")) person = relationship(Person) - engine = create_engine("sqlite:///:memory:") + engine = create_engine( + "sqlite:///:memory:", connect_args={"check_same_thread": False} + ) Base.metadata.create_all(engine) Session = sessionmaker(bind=engine) # noqa: N806 @@ -171,7 +175,9 @@ class Address(Base): person_id = Column(Integer, ForeignKey("person.id")) person = relationship(Person) - engine = create_engine("sqlite:///:memory:") + engine = create_engine( + "sqlite:///:memory:", connect_args={"check_same_thread": False} + ) engine.url = None Base.metadata.create_all(engine) @@ -207,7 +213,9 @@ def test_long_sql_query_preserved(sentry_init, capture_events): ) events = capture_events() - engine = create_engine("sqlite:///:memory:") + engine = create_engine( + "sqlite:///:memory:", connect_args={"check_same_thread": False} + ) with start_transaction(name="test"): with engine.connect() as con: con.execute(text(" UNION ".join("SELECT {}".format(i) for i in range(100)))) @@ -276,7 +284,9 @@ def test_engine_name_not_string(sentry_init): integrations=[SqlalchemyIntegration()], ) - engine = create_engine("sqlite:///:memory:") + engine = create_engine( + "sqlite:///:memory:", connect_args={"check_same_thread": False} + ) engine.dialect.name = b"sqlite" with engine.connect() as con: @@ -303,7 +313,9 @@ class Person(Base): id = Column(Integer, primary_key=True) name = Column(String(250), nullable=False) - engine = create_engine("sqlite:///:memory:") + engine = create_engine( + "sqlite:///:memory:", connect_args={"check_same_thread": False} + ) Base.metadata.create_all(engine) Session = sessionmaker(bind=engine) # noqa: N806 @@ -353,7 +365,9 @@ class Person(Base): id = Column(Integer, primary_key=True) name = Column(String(250), nullable=False) - engine = create_engine("sqlite:///:memory:") + engine = create_engine( + "sqlite:///:memory:", connect_args={"check_same_thread": False} + ) Base.metadata.create_all(engine) Session = sessionmaker(bind=engine) # noqa: N806 @@ -398,7 +412,9 @@ class Person(Base): id = Column(Integer, primary_key=True) name = Column(String(250), nullable=False) - engine = create_engine("sqlite:///:memory:") + engine = create_engine( + "sqlite:///:memory:", connect_args={"check_same_thread": False} + ) Base.metadata.create_all(engine) Session = sessionmaker(bind=engine) # noqa: N806 @@ -466,7 +482,9 @@ class Person(Base): id = Column(Integer, primary_key=True) name = Column(String(250), nullable=False) - engine = create_engine("sqlite:///:memory:") + engine = create_engine( + "sqlite:///:memory:", connect_args={"check_same_thread": False} + ) Base.metadata.create_all(engine) Session = sessionmaker(bind=engine) # noqa: N806 @@ -522,7 +540,9 @@ class Person(Base): id = Column(Integer, primary_key=True) name = Column(String(250), nullable=False) - engine = create_engine("sqlite:///:memory:") + engine = create_engine( + "sqlite:///:memory:", connect_args={"check_same_thread": False} + ) Base.metadata.create_all(engine) Session = sessionmaker(bind=engine) # noqa: N806 @@ -586,7 +606,9 @@ class Person(Base): id = Column(Integer, primary_key=True) name = Column(String(250), nullable=False) - engine = create_engine("sqlite:///:memory:") + engine = create_engine( + "sqlite:///:memory:", connect_args={"check_same_thread": False} + ) Base.metadata.create_all(engine) Session = sessionmaker(bind=engine) # noqa: N806 From 3e02bdf5164e226e352969edee71c80b82bd8b3e Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Fri, 5 Apr 2024 11:55:39 +0200 Subject: [PATCH 41/60] trying somethin --- pytest.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytest.ini b/pytest.ini index f736c30496..b9b51fcf3f 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,6 +1,6 @@ [pytest] DJANGO_SETTINGS_MODULE = tests.integrations.django.myapp.settings -addopts = --tb=short +addopts = --tb=short --reuse-db markers = tests_internal_exceptions: Handle internal exceptions just as the SDK does, to test it. (Otherwise internal exceptions are recorded and reraised.) only: A temporary marker, to make pytest only run the tests with the mark, similar to jests `it.only`. To use, run `pytest -v -m only`. From 4a6e197fb271d3abc234df07156e0e929c1cc7b1 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Fri, 5 Apr 2024 12:04:10 +0200 Subject: [PATCH 42/60] ? --- pytest.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytest.ini b/pytest.ini index b9b51fcf3f..862724cb1a 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,6 +1,6 @@ [pytest] DJANGO_SETTINGS_MODULE = tests.integrations.django.myapp.settings -addopts = --tb=short --reuse-db +addopts = --tb=short --create-db markers = tests_internal_exceptions: Handle internal exceptions just as the SDK does, to test it. (Otherwise internal exceptions are recorded and reraised.) only: A temporary marker, to make pytest only run the tests with the mark, similar to jests `it.only`. To use, run `pytest -v -m only`. From f1117bcf46c2a68f259df47cbffa8ce01b56f908 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Fri, 5 Apr 2024 12:07:38 +0200 Subject: [PATCH 43/60] revert --- pytest.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytest.ini b/pytest.ini index 862724cb1a..b9b51fcf3f 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,6 +1,6 @@ [pytest] DJANGO_SETTINGS_MODULE = tests.integrations.django.myapp.settings -addopts = --tb=short --create-db +addopts = --tb=short --reuse-db markers = tests_internal_exceptions: Handle internal exceptions just as the SDK does, to test it. (Otherwise internal exceptions are recorded and reraised.) only: A temporary marker, to make pytest only run the tests with the mark, similar to jests `it.only`. To use, run `pytest -v -m only`. From 43c01765ed0f5a678b37891db696e35981bf4a83 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Fri, 5 Apr 2024 12:10:30 +0200 Subject: [PATCH 44/60] more revert --- pytest.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytest.ini b/pytest.ini index b9b51fcf3f..f736c30496 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,6 +1,6 @@ [pytest] DJANGO_SETTINGS_MODULE = tests.integrations.django.myapp.settings -addopts = --tb=short --reuse-db +addopts = --tb=short markers = tests_internal_exceptions: Handle internal exceptions just as the SDK does, to test it. (Otherwise internal exceptions are recorded and reraised.) only: A temporary marker, to make pytest only run the tests with the mark, similar to jests `it.only`. To use, run `pytest -v -m only`. From c9f035fc16ea85fa1e9b6c0feb0c70b4bfd8e893 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Fri, 5 Apr 2024 12:13:52 +0200 Subject: [PATCH 45/60] try reuse-db again --- pytest.ini | 2 +- test-requirements.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pytest.ini b/pytest.ini index f736c30496..b9b51fcf3f 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,6 +1,6 @@ [pytest] DJANGO_SETTINGS_MODULE = tests.integrations.django.myapp.settings -addopts = --tb=short +addopts = --tb=short --reuse-db markers = tests_internal_exceptions: Handle internal exceptions just as the SDK does, to test it. (Otherwise internal exceptions are recorded and reraised.) only: A temporary marker, to make pytest only run the tests with the mark, similar to jests `it.only`. To use, run `pytest -v -m only`. diff --git a/test-requirements.txt b/test-requirements.txt index 0798db0571..29690b5299 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,6 +1,7 @@ pip pytest pytest-cov +pytest-django pytest-forked pytest-localserver pytest-watch From d5ec5f416a3551d70042ad6e586dcafc2e8a23ce Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Fri, 5 Apr 2024 12:17:38 +0200 Subject: [PATCH 46/60] ? --- pytest.ini | 2 +- test-requirements.txt | 1 - tox.ini | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pytest.ini b/pytest.ini index b9b51fcf3f..f736c30496 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,6 +1,6 @@ [pytest] DJANGO_SETTINGS_MODULE = tests.integrations.django.myapp.settings -addopts = --tb=short --reuse-db +addopts = --tb=short markers = tests_internal_exceptions: Handle internal exceptions just as the SDK does, to test it. (Otherwise internal exceptions are recorded and reraised.) only: A temporary marker, to make pytest only run the tests with the mark, similar to jests `it.only`. To use, run `pytest -v -m only`. diff --git a/test-requirements.txt b/test-requirements.txt index 29690b5299..0798db0571 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,7 +1,6 @@ pip pytest pytest-cov -pytest-django pytest-forked pytest-localserver pytest-watch diff --git a/tox.ini b/tox.ini index 61e0fb8930..3b5f35b1fd 100644 --- a/tox.ini +++ b/tox.ini @@ -667,6 +667,7 @@ commands = ; when loading tests in scenarios. In particular, django fails to ; load the settings from the test module. {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}: python -m pytest -rsfx -s --durations=5 -vvv {env:TESTPATH} {posargs} + django: python -m pytest -rsfx -s --durations=5 -vvv --reuse-db {env:TESTPATH} {posargs} [testenv:linters] commands = From 9e2202c853eca4855ab4d0404331d26f93622662 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Fri, 5 Apr 2024 12:26:28 +0200 Subject: [PATCH 47/60] ? --- pytest.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytest.ini b/pytest.ini index f736c30496..862724cb1a 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,6 +1,6 @@ [pytest] DJANGO_SETTINGS_MODULE = tests.integrations.django.myapp.settings -addopts = --tb=short +addopts = --tb=short --create-db markers = tests_internal_exceptions: Handle internal exceptions just as the SDK does, to test it. (Otherwise internal exceptions are recorded and reraised.) only: A temporary marker, to make pytest only run the tests with the mark, similar to jests `it.only`. To use, run `pytest -v -m only`. From 1e36124597e0c98529c5ad921d3049d2c617b8d1 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Fri, 5 Apr 2024 12:29:39 +0200 Subject: [PATCH 48/60] revert --- pytest.ini | 2 +- tox.ini | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/pytest.ini b/pytest.ini index 862724cb1a..f736c30496 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,6 +1,6 @@ [pytest] DJANGO_SETTINGS_MODULE = tests.integrations.django.myapp.settings -addopts = --tb=short --create-db +addopts = --tb=short markers = tests_internal_exceptions: Handle internal exceptions just as the SDK does, to test it. (Otherwise internal exceptions are recorded and reraised.) only: A temporary marker, to make pytest only run the tests with the mark, similar to jests `it.only`. To use, run `pytest -v -m only`. diff --git a/tox.ini b/tox.ini index 3b5f35b1fd..61e0fb8930 100644 --- a/tox.ini +++ b/tox.ini @@ -667,7 +667,6 @@ commands = ; when loading tests in scenarios. In particular, django fails to ; load the settings from the test module. {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}: python -m pytest -rsfx -s --durations=5 -vvv {env:TESTPATH} {posargs} - django: python -m pytest -rsfx -s --durations=5 -vvv --reuse-db {env:TESTPATH} {posargs} [testenv:linters] commands = From 123192de9ed84d6a9fb354dc943acb933e87ba9a Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Fri, 5 Apr 2024 14:23:18 +0200 Subject: [PATCH 49/60] see pytest output? --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 61e0fb8930..61a601eb5b 100644 --- a/tox.ini +++ b/tox.ini @@ -666,7 +666,7 @@ commands = ; Running `py.test` as an executable suffers from an import error ; when loading tests in scenarios. In particular, django fails to ; load the settings from the test module. - {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}: python -m pytest -rsfx -s --durations=5 -vvv {env:TESTPATH} {posargs} + {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}: python -m pytest -rsfx --durations=5 -vvv {env:TESTPATH} {posargs} [testenv:linters] commands = From 2d141e18ee6e26ec4bcab4538fcdf088e211d704 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Fri, 5 Apr 2024 14:29:24 +0200 Subject: [PATCH 50/60] more pytest capturing --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 61a601eb5b..8e9a36a5de 100644 --- a/tox.ini +++ b/tox.ini @@ -666,7 +666,7 @@ commands = ; Running `py.test` as an executable suffers from an import error ; when loading tests in scenarios. In particular, django fails to ; load the settings from the test module. - {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}: python -m pytest -rsfx --durations=5 -vvv {env:TESTPATH} {posargs} + {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}: python -m pytest -rfx --durations=5 -vvv {env:TESTPATH} {posargs} [testenv:linters] commands = From 87004c78c29cd54f792b759d5c023c5a96934b2e Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Fri, 5 Apr 2024 14:34:15 +0200 Subject: [PATCH 51/60] more pytest stuff --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 8e9a36a5de..03e04f79e0 100644 --- a/tox.ini +++ b/tox.ini @@ -666,7 +666,7 @@ commands = ; Running `py.test` as an executable suffers from an import error ; when loading tests in scenarios. In particular, django fails to ; load the settings from the test module. - {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}: python -m pytest -rfx --durations=5 -vvv {env:TESTPATH} {posargs} + {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}: python -m pytest -rfEs --durations=5 -vvv {env:TESTPATH} {posargs} [testenv:linters] commands = From 1a860131d3466bb663d716926496d527bcb96344 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Fri, 5 Apr 2024 14:36:40 +0200 Subject: [PATCH 52/60] wip --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 03e04f79e0..c6263077a6 100644 --- a/tox.ini +++ b/tox.ini @@ -666,7 +666,7 @@ commands = ; Running `py.test` as an executable suffers from an import error ; when loading tests in scenarios. In particular, django fails to ; load the settings from the test module. - {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}: python -m pytest -rfEs --durations=5 -vvv {env:TESTPATH} {posargs} + {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}: python -m pytest -rfEs -s --durations=5 -vvv {env:TESTPATH} {posargs} [testenv:linters] commands = From 06167b6e246043c1c00272be31d867e850a0a2e7 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Fri, 5 Apr 2024 15:09:14 +0200 Subject: [PATCH 53/60] sanity check --- .github/workflows/test-integrations-web-frameworks-1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-integrations-web-frameworks-1.yml b/.github/workflows/test-integrations-web-frameworks-1.yml index 4a8f9140bc..7ab1546abd 100644 --- a/.github/workflows/test-integrations-web-frameworks-1.yml +++ b/.github/workflows/test-integrations-web-frameworks-1.yml @@ -57,7 +57,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Setup Test Env run: | - pip install coverage tox + pip install coverage "tox>=3,<4" psql postgresql://postgres:sentry@localhost:5432 -c "create database ${SENTRY_PYTHON_TEST_POSTGRES_NAME};" || true psql postgresql://postgres:sentry@localhost:5432 -c "grant all privileges on database ${SENTRY_PYTHON_TEST_POSTGRES_NAME} to ${SENTRY_PYTHON_TEST_POSTGRES_USER};" || true - name: Erase coverage From 0bbac1dcfbb7ef2fb915373f547357e31f5fd1c3 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Fri, 5 Apr 2024 15:15:01 +0200 Subject: [PATCH 54/60] apparently it isnt tox --- .github/workflows/test-integrations-web-frameworks-1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-integrations-web-frameworks-1.yml b/.github/workflows/test-integrations-web-frameworks-1.yml index 7ab1546abd..4a8f9140bc 100644 --- a/.github/workflows/test-integrations-web-frameworks-1.yml +++ b/.github/workflows/test-integrations-web-frameworks-1.yml @@ -57,7 +57,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Setup Test Env run: | - pip install coverage "tox>=3,<4" + pip install coverage tox psql postgresql://postgres:sentry@localhost:5432 -c "create database ${SENTRY_PYTHON_TEST_POSTGRES_NAME};" || true psql postgresql://postgres:sentry@localhost:5432 -c "grant all privileges on database ${SENTRY_PYTHON_TEST_POSTGRES_NAME} to ${SENTRY_PYTHON_TEST_POSTGRES_USER};" || true - name: Erase coverage From 2ad00686eea7089b9cca1d2d180ea421332cbd16 Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Mon, 8 Apr 2024 11:25:16 +0200 Subject: [PATCH 55/60] Run tests in new tooling (#2938) Make sure the Django tests are always run with a unique database name that is cleaned up after the tests have been run. --- .../workflows/test-integrations-databases.yml | 10 ++------ .../test-integrations-web-frameworks-1.yml | 10 ++------ scripts/runtox.sh | 2 +- .../templates/test_group.jinja | 9 ++----- tests/integrations/asyncpg/test_asyncpg.py | 6 ++--- tests/integrations/django/asgi/test_asgi.py | 24 ++++++++++++++----- tests/integrations/django/myapp/settings.py | 10 +++++--- tox.ini | 8 +++---- 8 files changed, 39 insertions(+), 40 deletions(-) diff --git a/.github/workflows/test-integrations-databases.yml b/.github/workflows/test-integrations-databases.yml index 3e7f5bfb4f..e037d06a1e 100644 --- a/.github/workflows/test-integrations-databases.yml +++ b/.github/workflows/test-integrations-databases.yml @@ -46,10 +46,9 @@ jobs: ports: - 5432:5432 env: + SENTRY_PYTHON_TEST_POSTGRES_HOST: localhost SENTRY_PYTHON_TEST_POSTGRES_USER: postgres SENTRY_PYTHON_TEST_POSTGRES_PASSWORD: sentry - SENTRY_PYTHON_TEST_POSTGRES_NAME: ci_test - SENTRY_PYTHON_TEST_POSTGRES_HOST: localhost steps: - uses: actions/checkout@v4.1.1 - uses: actions/setup-python@v5 @@ -59,8 +58,6 @@ jobs: - name: Setup Test Env run: | pip install coverage tox - psql postgresql://postgres:sentry@localhost:5432 -c "create database ${SENTRY_PYTHON_TEST_POSTGRES_NAME};" || true - psql postgresql://postgres:sentry@localhost:5432 -c "grant all privileges on database ${SENTRY_PYTHON_TEST_POSTGRES_NAME} to ${SENTRY_PYTHON_TEST_POSTGRES_USER};" || true - name: Erase coverage run: | coverage erase @@ -124,10 +121,9 @@ jobs: ports: - 5432:5432 env: + SENTRY_PYTHON_TEST_POSTGRES_HOST: localhost SENTRY_PYTHON_TEST_POSTGRES_USER: postgres SENTRY_PYTHON_TEST_POSTGRES_PASSWORD: sentry - SENTRY_PYTHON_TEST_POSTGRES_NAME: ci_test - SENTRY_PYTHON_TEST_POSTGRES_HOST: localhost steps: - uses: actions/checkout@v4.1.1 - uses: actions/setup-python@v5 @@ -137,8 +133,6 @@ jobs: - name: Setup Test Env run: | pip install coverage tox - psql postgresql://postgres:sentry@localhost:5432 -c "create database ${SENTRY_PYTHON_TEST_POSTGRES_NAME};" || true - psql postgresql://postgres:sentry@localhost:5432 -c "grant all privileges on database ${SENTRY_PYTHON_TEST_POSTGRES_NAME} to ${SENTRY_PYTHON_TEST_POSTGRES_USER};" || true - name: Erase coverage run: | coverage erase diff --git a/.github/workflows/test-integrations-web-frameworks-1.yml b/.github/workflows/test-integrations-web-frameworks-1.yml index 4a8f9140bc..0d6f76442f 100644 --- a/.github/workflows/test-integrations-web-frameworks-1.yml +++ b/.github/workflows/test-integrations-web-frameworks-1.yml @@ -46,10 +46,9 @@ jobs: ports: - 5432:5432 env: + SENTRY_PYTHON_TEST_POSTGRES_HOST: localhost SENTRY_PYTHON_TEST_POSTGRES_USER: postgres SENTRY_PYTHON_TEST_POSTGRES_PASSWORD: sentry - SENTRY_PYTHON_TEST_POSTGRES_NAME: ci_test - SENTRY_PYTHON_TEST_POSTGRES_HOST: localhost steps: - uses: actions/checkout@v4.1.1 - uses: actions/setup-python@v5 @@ -58,8 +57,6 @@ jobs: - name: Setup Test Env run: | pip install coverage tox - psql postgresql://postgres:sentry@localhost:5432 -c "create database ${SENTRY_PYTHON_TEST_POSTGRES_NAME};" || true - psql postgresql://postgres:sentry@localhost:5432 -c "grant all privileges on database ${SENTRY_PYTHON_TEST_POSTGRES_NAME} to ${SENTRY_PYTHON_TEST_POSTGRES_USER};" || true - name: Erase coverage run: | coverage erase @@ -115,10 +112,9 @@ jobs: ports: - 5432:5432 env: + SENTRY_PYTHON_TEST_POSTGRES_HOST: localhost SENTRY_PYTHON_TEST_POSTGRES_USER: postgres SENTRY_PYTHON_TEST_POSTGRES_PASSWORD: sentry - SENTRY_PYTHON_TEST_POSTGRES_NAME: ci_test - SENTRY_PYTHON_TEST_POSTGRES_HOST: localhost steps: - uses: actions/checkout@v4.1.1 - uses: actions/setup-python@v5 @@ -127,8 +123,6 @@ jobs: - name: Setup Test Env run: | pip install coverage tox - psql postgresql://postgres:sentry@localhost:5432 -c "create database ${SENTRY_PYTHON_TEST_POSTGRES_NAME};" || true - psql postgresql://postgres:sentry@localhost:5432 -c "grant all privileges on database ${SENTRY_PYTHON_TEST_POSTGRES_NAME} to ${SENTRY_PYTHON_TEST_POSTGRES_USER};" || true - name: Erase coverage run: | coverage erase diff --git a/scripts/runtox.sh b/scripts/runtox.sh index dbbb4f2e10..50da44dd53 100755 --- a/scripts/runtox.sh +++ b/scripts/runtox.sh @@ -40,4 +40,4 @@ if [ -z "${ENV}" ]; then exit 0 fi -exec $TOXPATH -vv -e "$ENV" -- "${@:2}" +exec $TOXPATH -e "$ENV" -- "${@:2}" diff --git a/scripts/split-tox-gh-actions/templates/test_group.jinja b/scripts/split-tox-gh-actions/templates/test_group.jinja index 58692d99d0..07ff88b54e 100644 --- a/scripts/split-tox-gh-actions/templates/test_group.jinja +++ b/scripts/split-tox-gh-actions/templates/test_group.jinja @@ -32,10 +32,10 @@ ports: - 5432:5432 env: + SENTRY_PYTHON_TEST_POSTGRES_HOST: localhost SENTRY_PYTHON_TEST_POSTGRES_USER: postgres SENTRY_PYTHON_TEST_POSTGRES_PASSWORD: sentry - SENTRY_PYTHON_TEST_POSTGRES_NAME: ci_test - SENTRY_PYTHON_TEST_POSTGRES_HOST: localhost + {% endif %} steps: @@ -56,10 +56,6 @@ - name: Setup Test Env run: | pip install coverage tox - {% if needs_postgres %} - psql postgresql://postgres:sentry@localhost:5432 -c "create database ${SENTRY_PYTHON_TEST_POSTGRES_NAME};" || true - psql postgresql://postgres:sentry@localhost:5432 -c "grant all privileges on database ${SENTRY_PYTHON_TEST_POSTGRES_NAME} to ${SENTRY_PYTHON_TEST_POSTGRES_USER};" || true - {% endif %} - name: Erase coverage run: | @@ -69,7 +65,6 @@ - name: Test {{ framework }} {{ category }} run: | set -x # print commands that are executed - {% if category == "pinned" %} ./scripts/runtox.sh --exclude-latest "{% raw %}py${{ matrix.python-version }}{% endraw %}-{{ framework }}" --cov=tests --cov=sentry_sdk --cov-report= --cov-branch {% elif category == "latest" %} diff --git a/tests/integrations/asyncpg/test_asyncpg.py b/tests/integrations/asyncpg/test_asyncpg.py index b0f1645d6b..9140216996 100644 --- a/tests/integrations/asyncpg/test_asyncpg.py +++ b/tests/integrations/asyncpg/test_asyncpg.py @@ -12,11 +12,11 @@ import os -PG_NAME = os.getenv("SENTRY_PYTHON_TEST_POSTGRES_NAME", "postgres") -PG_USER = os.getenv("SENTRY_PYTHON_TEST_POSTGRES_USER", "foo") -PG_PASSWORD = os.getenv("SENTRY_PYTHON_TEST_POSTGRES_PASSWORD", "bar") PG_HOST = os.getenv("SENTRY_PYTHON_TEST_POSTGRES_HOST", "localhost") PG_PORT = 5432 +PG_USER = os.getenv("SENTRY_PYTHON_TEST_POSTGRES_USER", "postgres") +PG_PASSWORD = os.getenv("SENTRY_PYTHON_TEST_POSTGRES_PASSWORD", "sentry") +PG_NAME = os.getenv("SENTRY_PYTHON_TEST_POSTGRES_NAME", "postgres") import datetime from contextlib import contextmanager diff --git a/tests/integrations/django/asgi/test_asgi.py b/tests/integrations/django/asgi/test_asgi.py index 87c85109ef..fd266c4fae 100644 --- a/tests/integrations/django/asgi/test_asgi.py +++ b/tests/integrations/django/asgi/test_asgi.py @@ -133,8 +133,12 @@ async def test_async_views_concurrent_execution(sentry_init, settings): sentry_init(integrations=[DjangoIntegration()], send_default_pii=True) - comm = HttpCommunicator(asgi_application, "GET", "/my_async_view") - comm2 = HttpCommunicator(asgi_application, "GET", "/my_async_view") + comm = HttpCommunicator( + asgi_application, "GET", "/my_async_view" + ) # sleeps for 1 second + comm2 = HttpCommunicator( + asgi_application, "GET", "/my_async_view" + ) # sleeps for 1 second loop = asyncio.get_event_loop() @@ -150,7 +154,9 @@ async def test_async_views_concurrent_execution(sentry_init, settings): assert resp1.result()["status"] == 200 assert resp2.result()["status"] == 200 - assert end - start < 1.5 + assert ( + end - start < 2 + ) # it takes less than 2 seconds so it was ececuting concurrently @pytest.mark.asyncio @@ -171,8 +177,12 @@ async def test_async_middleware_that_is_function_concurrent_execution( sentry_init(integrations=[DjangoIntegration()], send_default_pii=True) - comm = HttpCommunicator(asgi_application, "GET", "/my_async_view") - comm2 = HttpCommunicator(asgi_application, "GET", "/my_async_view") + comm = HttpCommunicator( + asgi_application, "GET", "/my_async_view" + ) # sleeps for 1 second + comm2 = HttpCommunicator( + asgi_application, "GET", "/my_async_view" + ) # sleeps for 1 second loop = asyncio.get_event_loop() @@ -188,7 +198,9 @@ async def test_async_middleware_that_is_function_concurrent_execution( assert resp1.result()["status"] == 200 assert resp2.result()["status"] == 200 - assert end - start < 1.5 + assert ( + end - start < 2 + ) # it takes less than 2 seconds so it was ececuting concurrently @pytest.mark.asyncio diff --git a/tests/integrations/django/myapp/settings.py b/tests/integrations/django/myapp/settings.py index 721cef0984..bcb137e684 100644 --- a/tests/integrations/django/myapp/settings.py +++ b/tests/integrations/django/myapp/settings.py @@ -10,6 +10,8 @@ https://docs.djangoproject.com/en/2.0/ref/settings/ """ +import random + # We shouldn't access settings while setting up integrations. Initialize SDK # here to provoke any errors that might occur. import sentry_sdk @@ -121,11 +123,13 @@ def middleware(request): DATABASES["postgres"] = { "ENGINE": db_engine, - "NAME": os.environ["SENTRY_PYTHON_TEST_POSTGRES_NAME"], - "USER": os.environ["SENTRY_PYTHON_TEST_POSTGRES_USER"], - "PASSWORD": os.environ["SENTRY_PYTHON_TEST_POSTGRES_PASSWORD"], "HOST": os.environ.get("SENTRY_PYTHON_TEST_POSTGRES_HOST", "localhost"), "PORT": 5432, + "USER": os.environ.get("SENTRY_PYTHON_TEST_POSTGRES_USER", "postgres"), + "PASSWORD": os.environ.get("SENTRY_PYTHON_TEST_POSTGRES_PASSWORD", "sentry"), + "NAME": os.environ.get( + "SENTRY_PYTHON_TEST_POSTGRES_NAME", f"myapp_db_{random.randint(0, 1000)}" + ), } except (ImportError, KeyError): from sentry_sdk.utils import logger diff --git a/tox.ini b/tox.ini index c6263077a6..e193de52b1 100644 --- a/tox.ini +++ b/tox.ini @@ -342,8 +342,8 @@ deps = django-v{1.11,2.0,2.1,2.2,3.0,3.1,3.2}: djangorestframework>=3.0.0,<4.0.0 django-v{2.0,2.2,3.0,3.2,4.0,4.1,4.2,5.0}: channels[daphne] django-v{1.11,2.0,2.2,3.0,3.2}: Werkzeug<2.1.0 - django-v{1.11,2.0}: pytest-django<4.0 - django-v{2.2,3.0,3.2,4.0,4.1,4.2,5.0}: pytest-django + django-v{1.11,2.0,2.2,3.0}: pytest-django<4.0 + django-v{3.2,4.0,4.1,4.2,5.0}: pytest-django django-v{4.0,4.1,4.2,5.0}: djangorestframework django-v{4.0,4.1,4.2,5.0}: pytest-asyncio<=0.21.1 django-v{4.0,4.1,4.2,5.0}: Werkzeug @@ -630,10 +630,10 @@ setenv = passenv = SENTRY_PYTHON_TEST_AWS_ACCESS_KEY_ID SENTRY_PYTHON_TEST_AWS_SECRET_ACCESS_KEY + SENTRY_PYTHON_TEST_POSTGRES_HOST SENTRY_PYTHON_TEST_POSTGRES_USER SENTRY_PYTHON_TEST_POSTGRES_PASSWORD SENTRY_PYTHON_TEST_POSTGRES_NAME - SENTRY_PYTHON_TEST_POSTGRES_HOST usedevelop = True extras = bottle: bottle @@ -666,7 +666,7 @@ commands = ; Running `py.test` as an executable suffers from an import error ; when loading tests in scenarios. In particular, django fails to ; load the settings from the test module. - {py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12}: python -m pytest -rfEs -s --durations=5 -vvv {env:TESTPATH} {posargs} + python -m pytest -rfEs -s --durations=5 -vvv {env:TESTPATH} {posargs} [testenv:linters] commands = From bf65327264da84cae81e3eb08ff293ef3ef1c611 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Mon, 8 Apr 2024 11:38:38 +0200 Subject: [PATCH 56/60] another sanity check --- test-requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index 0798db0571..dae2f5c356 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,9 +4,9 @@ pytest-cov pytest-forked pytest-localserver pytest-watch -tox -#tox; python_version<'3.12' -#tox<4; python_version>='3.12' # TODO: >=4 makes async django tests hang in CI +#tox +tox; python_version<'3.12' +tox<4; python_version>='3.12' # TODO: >=4 makes async django tests hang in CI jsonschema pyrsistent executing From e1f2ec1cd966980cd5fd4f8d986f8bfd2e766294 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Mon, 8 Apr 2024 11:48:03 +0200 Subject: [PATCH 57/60] ? --- test-requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index dae2f5c356..de54d31891 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -5,8 +5,8 @@ pytest-forked pytest-localserver pytest-watch #tox -tox; python_version<'3.12' -tox<4; python_version>='3.12' # TODO: >=4 makes async django tests hang in CI +#tox; python_version<'3.12' +#tox<4; python_version>='3.12' # TODO: >=4 makes async django tests hang in CI jsonschema pyrsistent executing From 46c54381bb154828dee88f324150184cd69a5079 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Mon, 8 Apr 2024 11:49:11 +0200 Subject: [PATCH 58/60] verbosity --- scripts/runtox.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/runtox.sh b/scripts/runtox.sh index 50da44dd53..9150117f27 100755 --- a/scripts/runtox.sh +++ b/scripts/runtox.sh @@ -40,4 +40,4 @@ if [ -z "${ENV}" ]; then exit 0 fi -exec $TOXPATH -e "$ENV" -- "${@:2}" +exec $TOXPATH -v -e "$ENV" -- "${@:2}" From f89432a5cea26ded3f7c825425f79326344bde61 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Mon, 8 Apr 2024 11:56:10 +0200 Subject: [PATCH 59/60] remove tox from test-requirements --- test-requirements.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index de54d31891..15f150097d 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,9 +4,6 @@ pytest-cov pytest-forked pytest-localserver pytest-watch -#tox -#tox; python_version<'3.12' -#tox<4; python_version>='3.12' # TODO: >=4 makes async django tests hang in CI jsonschema pyrsistent executing From 7571be8c0cd67628713a66d1c0b7d4408f8d21d6 Mon Sep 17 00:00:00 2001 From: Ivana Kellyerova Date: Mon, 8 Apr 2024 11:58:15 +0200 Subject: [PATCH 60/60] ok this is too much --- scripts/runtox.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/runtox.sh b/scripts/runtox.sh index 9150117f27..50da44dd53 100755 --- a/scripts/runtox.sh +++ b/scripts/runtox.sh @@ -40,4 +40,4 @@ if [ -z "${ENV}" ]; then exit 0 fi -exec $TOXPATH -v -e "$ENV" -- "${@:2}" +exec $TOXPATH -e "$ENV" -- "${@:2}"