Skip to content

tests: Regenerate tox.ini & fix CI #4435

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jun 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/test-integrations-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ jobs:
allow-prereleases: true
- name: Start Redis
uses: supercharge/redis-github-action@1.8.0
- name: Install Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Setup Test Env
run: |
pip install "coverage[toml]" tox
Expand Down Expand Up @@ -135,6 +140,11 @@ jobs:
allow-prereleases: true
- name: Start Redis
uses: supercharge/redis-github-action@1.8.0
- name: Install Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Setup Test Env
run: |
pip install "coverage[toml]" tox
Expand Down
4 changes: 2 additions & 2 deletions scripts/populate_tox/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@
"pytest-django",
"Werkzeug",
],
">=3.0": ["pytest-asyncio"],
">=2.0": ["channels[daphne]"],
">=2.2,<3.1": ["six"],
">=3.0": ["pytest-asyncio"],
"<3.3": [
"djangorestframework>=3.0,<4.0",
"Werkzeug<2.1.0",
],
"<3.1": ["pytest-django<4.0"],
">=2.0": ["channels[daphne]"],
},
},
"dramatiq": {
Expand Down
2 changes: 2 additions & 0 deletions scripts/populate_tox/tox.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ deps =
# for justification of the upper bound on pytest
{py3.6,py3.7}-gevent: pytest<7.0.0
{py3.8,py3.9,py3.10,py3.11,py3.12}-gevent: pytest
gevent: pytest-asyncio

# === Integrations ===

Expand Down Expand Up @@ -362,6 +363,7 @@ setenv =
py3.6: COVERAGE_RCFILE=.coveragerc36

django: DJANGO_SETTINGS_MODULE=tests.integrations.django.myapp.settings
spark-v{3.0.3,3.5.6}: JAVA_HOME=/usr/lib/jvm/temurin-11-jdk-amd64

common: TESTPATH=tests
gevent: TESTPATH=tests
Expand Down
5 changes: 5 additions & 0 deletions scripts/split_tox_gh_actions/split_tox_gh_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
"aws_lambda",
}

FRAMEWORKS_NEEDING_JAVA = {
"spark",
}

# Frameworks grouped here will be tested together to not hog all GitHub runners.
# If you add or remove a group, make sure to git rm the generated YAML file as
# well.
Expand Down Expand Up @@ -288,6 +292,7 @@ def render_template(group, frameworks, py_versions_pinned, py_versions_latest):
"needs_docker": bool(set(frameworks) & FRAMEWORKS_NEEDING_DOCKER),
"needs_postgres": bool(set(frameworks) & FRAMEWORKS_NEEDING_POSTGRES),
"needs_redis": bool(set(frameworks) & FRAMEWORKS_NEEDING_REDIS),
"needs_java": bool(set(frameworks) & FRAMEWORKS_NEEDING_JAVA),
"py_versions": {
category: [f'"{version}"' for version in _normalize_py_versions(versions)]
for category, versions in py_versions.items()
Expand Down
9 changes: 9 additions & 0 deletions scripts/split_tox_gh_actions/templates/test_group.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
with:
python-version: {% raw %}${{ matrix.python-version }}{% endraw %}
allow-prereleases: true

{% if needs_clickhouse %}
- name: "Setup ClickHouse Server"
uses: getsentry/action-clickhouse-in-ci@v1.6
Expand All @@ -58,6 +59,14 @@
uses: supercharge/redis-github-action@1.8.0
{% endif %}

{% if needs_java %}
- name: Install Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
{% endif %}

- name: Setup Test Env
run: |
pip install "coverage[toml]" tox
Expand Down
15 changes: 15 additions & 0 deletions tests/integrations/django/asgi/test_asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
@pytest.mark.parametrize("application", APPS)
@pytest.mark.asyncio
@pytest.mark.forked
@pytest.mark.skipif(
django.VERSION < (3, 0), reason="Django ASGI support shipped in 3.0"
)
async def test_basic(sentry_init, capture_events, application):
sentry_init(
integrations=[DjangoIntegration()],
Expand Down Expand Up @@ -579,6 +582,9 @@ async def test_asgi_request_body(
"asyncio.iscoroutinefunction has been replaced in 3.12 by inspect.iscoroutinefunction"
),
)
@pytest.mark.skipif(
django.VERSION < (3, 0), reason="Django ASGI support shipped in 3.0"
)
async def test_asgi_mixin_iscoroutinefunction_before_3_12():
sentry_asgi_mixin = _asgi_middleware_mixin_factory(lambda: None)

Expand Down Expand Up @@ -636,6 +642,9 @@ def get_response(): ...

@pytest.mark.parametrize("application", APPS)
@pytest.mark.asyncio
@pytest.mark.skipif(
django.VERSION < (3, 1), reason="async views have been introduced in Django 3.1"
)
async def test_async_view(sentry_init, capture_events, application):
sentry_init(
integrations=[DjangoIntegration()],
Expand All @@ -655,6 +664,9 @@ async def test_async_view(sentry_init, capture_events, application):

@pytest.mark.parametrize("application", APPS)
@pytest.mark.asyncio
@pytest.mark.skipif(
django.VERSION < (3, 0), reason="Django ASGI support shipped in 3.0"
)
async def test_transaction_http_method_default(
sentry_init, capture_events, application
):
Expand Down Expand Up @@ -687,6 +699,9 @@ async def test_transaction_http_method_default(

@pytest.mark.parametrize("application", APPS)
@pytest.mark.asyncio
@pytest.mark.skipif(
django.VERSION < (3, 0), reason="Django ASGI support shipped in 3.0"
)
async def test_transaction_http_method_custom(sentry_init, capture_events, application):
sentry_init(
integrations=[
Expand Down
Loading
Loading