prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Switch unit tests from `unittest.mock` to SDK & in-memory exporter
  See https://github.com/open-telemetry/opentelemetry-python/pull/290#issuecomment-558091283.
  Currently tests are cumbersome to write and actually we probably don't want to test which API calls are made but what Spans would result in most cases. For this a SDK with in-memory exporter would be better than using `unittest.mock`.
  
  </issue>
  <code>
  [start of ext/opentelemetry-ext-testutil/src/opentelemetry/ext/testutil/wsgitestutil.py]
  1 import io
  2 import unittest
  3 import unittest.mock as mock
  4 import wsgiref.util as wsgiref_util
  5 
  6 from opentelemetry import trace as trace_api
  7 
  8 
  9 class WsgiTestBase(unittest.TestCase):
  10     def setUp(self):
  11         self.span = mock.create_autospec(trace_api.Span, spec_set=True)
  12         tracer = trace_api.Tracer()
  13         self.get_tracer_patcher = mock.patch.object(
  14             trace_api.TracerSource,
  15             "get_tracer",
  16             autospec=True,
  17             spec_set=True,
  18             return_value=tracer,
  19         )
  20         self.get_tracer_patcher.start()
  21 
  22         self.start_span_patcher = mock.patch.object(
  23             tracer,
  24             "start_span",
  25             autospec=True,
  26             spec_set=True,
  27             return_value=self.span,
  28         )
  29         self.start_span = self.start_span_patcher.start()
  30         self.write_buffer = io.BytesIO()
  31         self.write = self.write_buffer.write
  32 
  33         self.environ = {}
  34         wsgiref_util.setup_testing_defaults(self.environ)
  35 
  36         self.status = None
  37         self.response_headers = None
  38         self.exc_info = None
  39 
  40     def tearDown(self):
  41         self.get_tracer_patcher.stop()
  42         self.start_span_patcher.stop()
  43 
  44     def start_response(self, status, response_headers, exc_info=None):
  45         self.status = status
  46         self.response_headers = response_headers
  47         self.exc_info = exc_info
  48         return self.write
  49
  [end of ext/opentelemetry-ext-testutil/src/opentelemetry/ext/testutil/wsgitestutil.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/ext/opentelemetry-ext-testutil/src/opentelemetry/ext/testutil/wsgitestutil.py b/ext/opentelemetry-ext-testutil/src/opentelemetry/ext/testutil/wsgitestutil.py
  --- a/ext/opentelemetry-ext-testutil/src/opentelemetry/ext/testutil/wsgitestutil.py
  +++ b/ext/opentelemetry-ext-testutil/src/opentelemetry/ext/testutil/wsgitestutil.py
  @@ -1,32 +1,38 @@
   import io
   import unittest
  -import unittest.mock as mock
   import wsgiref.util as wsgiref_util
  +from importlib import reload
   
   from opentelemetry import trace as trace_api
  +from opentelemetry.sdk.trace import TracerSource, export
  +from opentelemetry.sdk.trace.export.in_memory_span_exporter import (
  +    InMemorySpanExporter,
  +)
  +
  +_MEMORY_EXPORTER = None
   
   
   class WsgiTestBase(unittest.TestCase):
  -    def setUp(self):
  -        self.span = mock.create_autospec(trace_api.Span, spec_set=True)
  -        tracer = trace_api.Tracer()
  -        self.get_tracer_patcher = mock.patch.object(
  -            trace_api.TracerSource,
  -            "get_tracer",
  -            autospec=True,
  -            spec_set=True,
  -            return_value=tracer,
  -        )
  -        self.get_tracer_patcher.start()
  -
  -        self.start_span_patcher = mock.patch.object(
  -            tracer,
  -            "start_span",
  -            autospec=True,
  -            spec_set=True,
  -            return_value=self.span,
  +    @classmethod
  +    def setUpClass(cls):
  +        global _MEMORY_EXPORTER  # pylint:disable=global-statement
  +        trace_api.set_preferred_tracer_source_implementation(
  +            lambda T: TracerSource()
           )
  -        self.start_span = self.start_span_patcher.start()
  +        tracer_source = trace_api.tracer_source()
  +        _MEMORY_EXPORTER = InMemorySpanExporter()
  +        span_processor = export.SimpleExportSpanProcessor(_MEMORY_EXPORTER)
  +        tracer_source.add_span_processor(span_processor)
  +
  +    @classmethod
  +    def tearDownClass(cls):
  +        reload(trace_api)
  +
  +    def setUp(self):
  +
  +        self.memory_exporter = _MEMORY_EXPORTER
  +        self.memory_exporter.clear()
  +
           self.write_buffer = io.BytesIO()
           self.write = self.write_buffer.write
   
  @@ -37,10 +43,6 @@
           self.response_headers = None
           self.exc_info = None
   
  -    def tearDown(self):
  -        self.get_tracer_patcher.stop()
  -        self.start_span_patcher.stop()
  -
       def start_response(self, status, response_headers, exc_info=None):
           self.status = status
           self.response_headers = response_headers
  
verification_info: {"golden_diff": "diff --git a/ext/opentelemetry-ext-testutil/src/opentelemetry/ext/testutil/wsgitestutil.py b/ext/opentelemetry-ext-testutil/src/opentelemetry/ext/testutil/wsgitestutil.py\n--- a/ext/opentelemetry-ext-testutil/src/opentelemetry/ext/testutil/wsgitestutil.py\n+++ b/ext/opentelemetry-ext-testutil/src/opentelemetry/ext/testutil/wsgitestutil.py\n@@ -1,32 +1,38 @@\n import io\n import unittest\n-import unittest.mock as mock\n import wsgiref.util as wsgiref_util\n+from importlib import reload\n \n from opentelemetry import trace as trace_api\n+from opentelemetry.sdk.trace import TracerSource, export\n+from opentelemetry.sdk.trace.export.in_memory_span_exporter import (\n+    InMemorySpanExporter,\n+)\n+\n+_MEMORY_EXPORTER = None\n \n \n class WsgiTestBase(unittest.TestCase):\n-    def setUp(self):\n-        self.span = mock.create_autospec(trace_api.Span, spec_set=True)\n-        tracer = trace_api.Tracer()\n-        self.get_tracer_patcher = mock.patch.object(\n-            trace_api.TracerSource,\n-            \"get_tracer\",\n-            autospec=True,\n-            spec_set=True,\n-            return_value=tracer,\n-        )\n-        self.get_tracer_patcher.start()\n-\n-        self.start_span_patcher = mock.patch.object(\n-            tracer,\n-            \"start_span\",\n-            autospec=True,\n-            spec_set=True,\n-            return_value=self.span,\n+    @classmethod\n+    def setUpClass(cls):\n+        global _MEMORY_EXPORTER  # pylint:disable=global-statement\n+        trace_api.set_preferred_tracer_source_implementation(\n+            lambda T: TracerSource()\n         )\n-        self.start_span = self.start_span_patcher.start()\n+        tracer_source = trace_api.tracer_source()\n+        _MEMORY_EXPORTER = InMemorySpanExporter()\n+        span_processor = export.SimpleExportSpanProcessor(_MEMORY_EXPORTER)\n+        tracer_source.add_span_processor(span_processor)\n+\n+    @classmethod\n+    def tearDownClass(cls):\n+        reload(trace_api)\n+\n+    def setUp(self):\n+\n+        self.memory_exporter = _MEMORY_EXPORTER\n+        self.memory_exporter.clear()\n+\n         self.write_buffer = io.BytesIO()\n         self.write = self.write_buffer.write\n \n@@ -37,10 +43,6 @@\n         self.response_headers = None\n         self.exc_info = None\n \n-    def tearDown(self):\n-        self.get_tracer_patcher.stop()\n-        self.start_span_patcher.stop()\n-\n     def start_response(self, status, response_headers, exc_info=None):\n         self.status = status\n         self.response_headers = response_headers\n", "issue": "Switch unit tests from `unittest.mock` to SDK & in-memory exporter\nSee https://github.com/open-telemetry/opentelemetry-python/pull/290#issuecomment-558091283.\r\nCurrently tests are cumbersome to write and actually we probably don't want to test which API calls are made but what Spans would result in most cases. For this a SDK with in-memory exporter would be better than using `unittest.mock`.\n", "before_files": [{"content": "import io\nimport unittest\nimport unittest.mock as mock\nimport wsgiref.util as wsgiref_util\n\nfrom opentelemetry import trace as trace_api\n\n\nclass WsgiTestBase(unittest.TestCase):\n    def setUp(self):\n        self.span = mock.create_autospec(trace_api.Span, spec_set=True)\n        tracer = trace_api.Tracer()\n        self.get_tracer_patcher = mock.patch.object(\n            trace_api.TracerSource,\n            \"get_tracer\",\n            autospec=True,\n            spec_set=True,\n            return_value=tracer,\n        )\n        self.get_tracer_patcher.start()\n\n        self.start_span_patcher = mock.patch.object(\n            tracer,\n            \"start_span\",\n            autospec=True,\n            spec_set=True,\n            return_value=self.span,\n        )\n        self.start_span = self.start_span_patcher.start()\n        self.write_buffer = io.BytesIO()\n        self.write = self.write_buffer.write\n\n        self.environ = {}\n        wsgiref_util.setup_testing_defaults(self.environ)\n\n        self.status = None\n        self.response_headers = None\n        self.exc_info = None\n\n    def tearDown(self):\n        self.get_tracer_patcher.stop()\n        self.start_span_patcher.stop()\n\n    def start_response(self, status, response_headers, exc_info=None):\n        self.status = status\n        self.response_headers = response_headers\n        self.exc_info = exc_info\n        return self.write\n", "path": "ext/opentelemetry-ext-testutil/src/opentelemetry/ext/testutil/wsgitestutil.py"}]}