Skip to content

Commit c2d5a76

Browse files
authored
tests: Regenerate tox.ini & fix CI (#4435)
Regular tox update and fix some stuff pyspark 4.0.0 came out and it needs a different java version, so updated that too Closes #4438
1 parent 7cf4ee4 commit c2d5a76

File tree

7 files changed

+98
-53
lines changed

7 files changed

+98
-53
lines changed

.github/workflows/test-integrations-tasks.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ jobs:
4646
allow-prereleases: true
4747
- name: Start Redis
4848
uses: supercharge/[email protected]
49+
- name: Install Java
50+
uses: actions/setup-java@v4
51+
with:
52+
distribution: 'temurin'
53+
java-version: '21'
4954
- name: Setup Test Env
5055
run: |
5156
pip install "coverage[toml]" tox
@@ -135,6 +140,11 @@ jobs:
135140
allow-prereleases: true
136141
- name: Start Redis
137142
uses: supercharge/[email protected]
143+
- name: Install Java
144+
uses: actions/setup-java@v4
145+
with:
146+
distribution: 'temurin'
147+
java-version: '21'
138148
- name: Setup Test Env
139149
run: |
140150
pip install "coverage[toml]" tox

scripts/populate_tox/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@
5858
"pytest-django",
5959
"Werkzeug",
6060
],
61-
">=3.0": ["pytest-asyncio"],
61+
">=2.0": ["channels[daphne]"],
6262
">=2.2,<3.1": ["six"],
63+
">=3.0": ["pytest-asyncio"],
6364
"<3.3": [
6465
"djangorestframework>=3.0,<4.0",
6566
"Werkzeug<2.1.0",
6667
],
6768
"<3.1": ["pytest-django<4.0"],
68-
">=2.0": ["channels[daphne]"],
6969
},
7070
},
7171
"dramatiq": {

scripts/populate_tox/tox.jinja

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ deps =
172172
# for justification of the upper bound on pytest
173173
{py3.6,py3.7}-gevent: pytest<7.0.0
174174
{py3.8,py3.9,py3.10,py3.11,py3.12}-gevent: pytest
175+
gevent: pytest-asyncio
175176
176177
# === Integrations ===
177178
@@ -362,6 +363,7 @@ setenv =
362363
py3.6: COVERAGE_RCFILE=.coveragerc36
363364
364365
django: DJANGO_SETTINGS_MODULE=tests.integrations.django.myapp.settings
366+
spark-v{3.0.3,3.5.6}: JAVA_HOME=/usr/lib/jvm/temurin-11-jdk-amd64
365367
366368
common: TESTPATH=tests
367369
gevent: TESTPATH=tests

scripts/split_tox_gh_actions/split_tox_gh_actions.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747
"aws_lambda",
4848
}
4949

50+
FRAMEWORKS_NEEDING_JAVA = {
51+
"spark",
52+
}
53+
5054
# Frameworks grouped here will be tested together to not hog all GitHub runners.
5155
# If you add or remove a group, make sure to git rm the generated YAML file as
5256
# well.
@@ -288,6 +292,7 @@ def render_template(group, frameworks, py_versions_pinned, py_versions_latest):
288292
"needs_docker": bool(set(frameworks) & FRAMEWORKS_NEEDING_DOCKER),
289293
"needs_postgres": bool(set(frameworks) & FRAMEWORKS_NEEDING_POSTGRES),
290294
"needs_redis": bool(set(frameworks) & FRAMEWORKS_NEEDING_REDIS),
295+
"needs_java": bool(set(frameworks) & FRAMEWORKS_NEEDING_JAVA),
291296
"py_versions": {
292297
category: [f'"{version}"' for version in _normalize_py_versions(versions)]
293298
for category, versions in py_versions.items()

scripts/split_tox_gh_actions/templates/test_group.jinja

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
with:
4949
python-version: {% raw %}${{ matrix.python-version }}{% endraw %}
5050
allow-prereleases: true
51+
5152
{% if needs_clickhouse %}
5253
- name: "Setup ClickHouse Server"
5354
uses: getsentry/[email protected]
@@ -58,6 +59,14 @@
5859
uses: supercharge/[email protected]
5960
{% endif %}
6061

62+
{% if needs_java %}
63+
- name: Install Java
64+
uses: actions/setup-java@v4
65+
with:
66+
distribution: 'temurin'
67+
java-version: '21'
68+
{% endif %}
69+
6170
- name: Setup Test Env
6271
run: |
6372
pip install "coverage[toml]" tox

tests/integrations/django/asgi/test_asgi.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
@pytest.mark.parametrize("application", APPS)
3131
@pytest.mark.asyncio
3232
@pytest.mark.forked
33+
@pytest.mark.skipif(
34+
django.VERSION < (3, 0), reason="Django ASGI support shipped in 3.0"
35+
)
3336
async def test_basic(sentry_init, capture_events, application):
3437
sentry_init(
3538
integrations=[DjangoIntegration()],
@@ -579,6 +582,9 @@ async def test_asgi_request_body(
579582
"asyncio.iscoroutinefunction has been replaced in 3.12 by inspect.iscoroutinefunction"
580583
),
581584
)
585+
@pytest.mark.skipif(
586+
django.VERSION < (3, 0), reason="Django ASGI support shipped in 3.0"
587+
)
582588
async def test_asgi_mixin_iscoroutinefunction_before_3_12():
583589
sentry_asgi_mixin = _asgi_middleware_mixin_factory(lambda: None)
584590

@@ -636,6 +642,9 @@ def get_response(): ...
636642

637643
@pytest.mark.parametrize("application", APPS)
638644
@pytest.mark.asyncio
645+
@pytest.mark.skipif(
646+
django.VERSION < (3, 1), reason="async views have been introduced in Django 3.1"
647+
)
639648
async def test_async_view(sentry_init, capture_events, application):
640649
sentry_init(
641650
integrations=[DjangoIntegration()],
@@ -655,6 +664,9 @@ async def test_async_view(sentry_init, capture_events, application):
655664

656665
@pytest.mark.parametrize("application", APPS)
657666
@pytest.mark.asyncio
667+
@pytest.mark.skipif(
668+
django.VERSION < (3, 0), reason="Django ASGI support shipped in 3.0"
669+
)
658670
async def test_transaction_http_method_default(
659671
sentry_init, capture_events, application
660672
):
@@ -687,6 +699,9 @@ async def test_transaction_http_method_default(
687699

688700
@pytest.mark.parametrize("application", APPS)
689701
@pytest.mark.asyncio
702+
@pytest.mark.skipif(
703+
django.VERSION < (3, 0), reason="Django ASGI support shipped in 3.0"
704+
)
690705
async def test_transaction_http_method_custom(sentry_init, capture_events, application):
691706
sentry_init(
692707
integrations=[

0 commit comments

Comments
 (0)