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

Removing reload in testbase #604

Merged
merged 3 commits into from
Apr 21, 2020
Merged

Conversation

codeboten
Copy link
Contributor

This is causing problems with integration tests as reload changes the id of trace.Span and therefore makes isinstance checks fail. Here's a code snippet of the problem:

>>> from opentelemetry import trace as trace_api
>>> from opentelemetry.sdk import trace as trace_sdk
>>> span = trace_sdk.Span("name", None)
>>> isinstance(span, trace_api.Span)
True
>>> from importlib import reload
>>> reload(trace_api)
<module 'opentelemetry.trace' from '/Users/alrex/dev/opentelemetry-python/opentelemetry-api/src/opentelemetry/trace/__init__.py'>
>>> isinstance(span, trace_api.Span)
False

@codeboten codeboten requested review from mauriciovasquezbernal and a team April 21, 2020 16:32
@@ -31,9 +30,5 @@ def setUpClass(cls):
span_processor = export.SimpleExportSpanProcessor(cls.memory_exporter)
cls.tracer_provider.add_span_processor(span_processor)

@classmethod
def tearDownClass(cls):
reload(trace_api)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did that because I wanted to invalidate the call to set_tracer_provider(cls.tracer_provider), could it be a good idea to invalidate that by doing something like set_tracer_provider(None)?

Copy link
Member

@mauriciovasquezbernal mauriciovasquezbernal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

@c24t c24t merged commit 16b9d88 into open-telemetry:master Apr 21, 2020
codeboten pushed a commit to codeboten/opentelemetry-python that referenced this pull request Apr 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants