Skip to content

Commit 963e0d5

Browse files
authored
Move importorskips in tests to __init__.py files (#2412)
Let's make the placement of the `importorskip`s consistent.
1 parent fb39f22 commit 963e0d5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+63
-58
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import pytest
22

3-
aiohttp = pytest.importorskip("aiohttp")
3+
pytest.importorskip("aiohttp")
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import pytest
2+
3+
pytest.importorskip("ariadne")
4+
pytest.importorskip("fastapi")
5+
pytest.importorskip("flask")

tests/integrations/ariadne/test_ariadne.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
import pytest
2-
3-
pytest.importorskip("ariadne")
4-
pytest.importorskip("fastapi")
5-
pytest.importorskip("flask")
6-
71
from ariadne import gql, graphql_sync, ObjectType, QueryType, make_executable_schema
82
from ariadne.asgi import GraphQL
93
from fastapi import FastAPI

tests/integrations/asgi/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pytest
22

3-
asyncio = pytest.importorskip("asyncio")
4-
pytest_asyncio = pytest.importorskip("pytest_asyncio")
3+
pytest.importorskip("asyncio")
4+
pytest.importorskip("pytest_asyncio")
5+
pytest.importorskip("async_asgi_testclient")

tests/integrations/asgi/test_asgi.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from sentry_sdk.integrations._asgi_common import _get_ip, _get_headers
99
from sentry_sdk.integrations.asgi import SentryAsgiMiddleware, _looks_like_asgi3
1010

11-
async_asgi_testclient = pytest.importorskip("async_asgi_testclient")
1211
from async_asgi_testclient import TestClient
1312

1413

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
import pytest
22

33
pytest.importorskip("asyncpg")
4+
pytest.importorskip("pytest_asyncio")

tests/integrations/asyncpg/test_asyncpg.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@
2222

2323
import asyncpg
2424
import pytest
25+
26+
import pytest_asyncio
27+
2528
from asyncpg import connect, Connection
2629

2730
from sentry_sdk import capture_message
2831
from sentry_sdk.integrations.asyncpg import AsyncPGIntegration
29-
from tests.integrations.asgi import pytest_asyncio
3032

3133

3234
PG_CONNECTION_URI = f"postgresql://{PG_USER}:{PG_PASSWORD}@{PG_HOST}/{PG_NAME}"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import pytest
2+
3+
pytest.importorskip("boto3")

tests/integrations/aws_lambda/test_aws.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
import pytest
2424

25-
boto3 = pytest.importorskip("boto3")
2625

2726
LAMBDA_PRELUDE = """
2827
from sentry_sdk.integrations.aws_lambda import AwsLambdaIntegration, get_lambda_bootstrap

tests/integrations/beam/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import pytest
2+
3+
pytest.importorskip("apache_beam")

0 commit comments

Comments
 (0)