import os


def fixture_response(path):
    return open(os.path.join(
        os.path.dirname(__file__),
        'fixtures',
        path)).read()

import os


def fixture_response(path):
    with open(os.path.join(os.path.dirname(__file__),
                           'fixtures',
                           path)) as fixture:
        return fixture.read()

Fix file handlers being left open for fixtures
Fix file handlers being left open for fixtures

  import os
  
  
  def fixture_response(path):
-     return open(os.path.join(
-         os.path.dirname(__file__),
-         'fixtures',
-         path)).read()
+     with open(os.path.join(os.path.dirname(__file__),
+                            'fixtures',
+                            path)) as fixture:
+         return fixture.read()
  
Fix file handlers being left open for fixtures
## Code Before:
import os


def fixture_response(path):
    return open(os.path.join(
        os.path.dirname(__file__),
        'fixtures',
        path)).read()

## Instruction:
Fix file handlers being left open for fixtures
## Code After:
import os


def fixture_response(path):
    with open(os.path.join(os.path.dirname(__file__),
                           'fixtures',
                           path)) as fixture:
        return fixture.read()
