Skip to content

Commit aa50804

Browse files
committed
Fix CI tests
1 parent bad01e3 commit aa50804

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

opentelemetry-api/src/opentelemetry/attributes/__init__.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,14 @@
2020

2121
from opentelemetry.util import types
2222

23+
WSGIRequest = None # type: ignore
24+
_HAS_DJANGO = False
2325
if TYPE_CHECKING:
2426
try:
2527
from django.core.handlers.wsgi import WSGIRequest
2628
_HAS_DJANGO = True
2729
except ImportError:
28-
WSGIRequest = None # type: ignore
29-
_HAS_DJANGO = False
30-
else:
31-
_HAS_DJANGO = False
30+
pass
3231

3332
# bytes are accepted as a user supplied value for attributes but
3433
# decoded to strings internally.

opentelemetry-api/tests/attributes/test_attributes.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,16 @@
1818
import unittest
1919
from typing import TYPE_CHECKING, MutableSequence
2020

21+
_HAS_DJANGO = False
22+
WSGIRequest = None
23+
settings = None
2124
if TYPE_CHECKING:
2225
try:
2326
from django.conf import settings
2427
from django.core.handlers.wsgi import WSGIRequest
2528
_HAS_DJANGO = True
2629
except ImportError:
27-
WSGIRequest = None # type: ignore
28-
settings = None # type: ignore
29-
_HAS_DJANGO = False
30-
else:
31-
_HAS_DJANGO = False
30+
pass
3231

3332
from opentelemetry.attributes import (
3433
BoundedAttributes,
@@ -197,7 +196,7 @@ def test_mapping(self):
197196

198197
def test_wsgi_request_attribute(self):
199198
if _HAS_DJANGO and WSGIRequest is not None:
200-
if not settings.configured:
199+
if settings and not settings.configured:
201200
settings.configure(
202201
DEBUG=True,
203202
SECRET_KEY="test-secret-key",

0 commit comments

Comments
 (0)