Skip to content
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

Remove contextvars workaround #2009

Merged
merged 6 commits into from
Aug 16, 2021
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

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,10 @@

from opentelemetry.context.context import Context, _RuntimeContext

if (3, 5, 3) <= version_info < (3, 7):
import aiocontextvars # type: ignore # pylint:disable=import-error
if version_info < (3, 7):
import aiocontextvars # type: ignore # pylint: disable=import-error

aiocontextvars # pylint:disable=pointless-statement

elif (3, 4) < version_info <= (3, 5, 2):
import opentelemetry.context.aiocontextvarsfix # pylint:disable=wrong-import-position

opentelemetry.context.aiocontextvarsfix # pylint:disable=pointless-statement
aiocontextvars # pylint: disable=pointless-statement


class ContextVarsRuntimeContext(_RuntimeContext):
Expand Down
10 changes: 1 addition & 9 deletions opentelemetry-api/tests/context/test_contextvars_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import unittest
from sys import version_info
from unittest.mock import patch

from opentelemetry import context
from opentelemetry.context.contextvars_context import ContextVarsRuntimeContext

from .base_context import ContextTestCases

if version_info.minor < 7:
raise unittest.SkipTest("contextvars not available")

from opentelemetry.context.contextvars_context import ( # pylint:disable=wrong-import-position
ContextVarsRuntimeContext,
)


class TestContextVarsContext(ContextTestCases.BaseTest):
def setUp(self) -> None:
Expand Down