def fake_distributions(versions):
      """Create a fake JDK for each java version in the input, and yield the list of java_homes.

      :param list versions: List of java version strings.
      """
      fakes = []
      for version in versions:
        fakes.append(distribution(
          executables=[EXE('bin/java', version), EXE('bin/javac', version)],
        ))
      yield [d.__enter__() for d in fakes]
      for d in fakes:
        d.__exit__(None, None, None)
    def fake_distributions(versions):
      """Create a fake JDK for each java version in the input, and yield the list of java_homes.

      :param list versions: List of java version strings.
      """
      fakes = []
      for version in versions:
        fakes.append(distribution(
          executables=[EXE('bin/java', version), EXE('bin/javac', version)],
        ))
      yield [d.__enter__() for d in fakes]
      for d in fakes:
        d.__exit__(None, None, None)