import time
import unittest

import pytest


class TerribleTerribleWayToWriteTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def setupBenchmark(self, benchmark):
        self.benchmark = benchmark

    def test_foo(self):
        self.benchmark(time.sleep, 0.000001)


class TerribleTerribleWayToWritePatchTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def setupBenchmark(self, benchmark_weave):
        self.benchmark_weave = benchmark_weave

    def test_foo2(self):
        with self.benchmark_weave('time.sleep'):
            time.sleep(0.0000001)

import time
import unittest

import pytest


class TerribleTerribleWayToWriteTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def setupBenchmark(self, benchmark):
        self.benchmark = benchmark

    def test_foo(self):
        self.benchmark(time.sleep, 0.000001)


class TerribleTerribleWayToWritePatchTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def setupBenchmark(self, benchmark_weave):
        self.benchmark_weave = benchmark_weave

    def test_foo2(self):
        self.benchmark_weave('time.sleep')
        time.sleep(0.0000001)

Remove use of context manager.
Remove use of context manager.

  import time
  import unittest
  
  import pytest
  
  
  class TerribleTerribleWayToWriteTests(unittest.TestCase):
      @pytest.fixture(autouse=True)
      def setupBenchmark(self, benchmark):
          self.benchmark = benchmark
  
      def test_foo(self):
          self.benchmark(time.sleep, 0.000001)
  
  
  class TerribleTerribleWayToWritePatchTests(unittest.TestCase):
      @pytest.fixture(autouse=True)
      def setupBenchmark(self, benchmark_weave):
          self.benchmark_weave = benchmark_weave
  
      def test_foo2(self):
-         with self.benchmark_weave('time.sleep'):
+         self.benchmark_weave('time.sleep')
-             time.sleep(0.0000001)
+         time.sleep(0.0000001)
  
Remove use of context manager.
## Code Before:
import time
import unittest

import pytest


class TerribleTerribleWayToWriteTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def setupBenchmark(self, benchmark):
        self.benchmark = benchmark

    def test_foo(self):
        self.benchmark(time.sleep, 0.000001)


class TerribleTerribleWayToWritePatchTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def setupBenchmark(self, benchmark_weave):
        self.benchmark_weave = benchmark_weave

    def test_foo2(self):
        with self.benchmark_weave('time.sleep'):
            time.sleep(0.0000001)

## Instruction:
Remove use of context manager.
## Code After:
import time
import unittest

import pytest


class TerribleTerribleWayToWriteTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def setupBenchmark(self, benchmark):
        self.benchmark = benchmark

    def test_foo(self):
        self.benchmark(time.sleep, 0.000001)


class TerribleTerribleWayToWritePatchTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def setupBenchmark(self, benchmark_weave):
        self.benchmark_weave = benchmark_weave

    def test_foo2(self):
        self.benchmark_weave('time.sleep')
        time.sleep(0.0000001)
