import os

import pytest

from tests.consts import examples_path
from valohai_yaml import parse


def _load_config(filename, roundtrip):
    with open(os.path.join(examples_path, filename), 'r') as infp:
        config = parse(infp)
    if roundtrip:
        config = parse(config.serialize())
    return config


def config_fixture(name):
    @pytest.fixture(params=[False, True])
    def _config_fixture(request):
        return _load_config(name, roundtrip=request.param)

    return _config_fixture

import os

import pytest

from tests.consts import examples_path
from valohai_yaml import parse


def _load_config(filename, roundtrip):
    with open(os.path.join(examples_path, filename), 'r') as infp:
        config = parse(infp)
    if roundtrip:
        config = parse(config.serialize())
    return config


def config_fixture(name):
    @pytest.fixture(params=[False, True], ids=['direct', 'roundtrip'])
    def _config_fixture(request):
        return _load_config(name, roundtrip=request.param)

    return _config_fixture

Add nicer ids for tests
Add nicer ids for tests

  import os
  
  import pytest
  
  from tests.consts import examples_path
  from valohai_yaml import parse
  
  
  def _load_config(filename, roundtrip):
      with open(os.path.join(examples_path, filename), 'r') as infp:
          config = parse(infp)
      if roundtrip:
          config = parse(config.serialize())
      return config
  
  
  def config_fixture(name):
-     @pytest.fixture(params=[False, True])
+     @pytest.fixture(params=[False, True], ids=['direct', 'roundtrip'])
      def _config_fixture(request):
          return _load_config(name, roundtrip=request.param)
  
      return _config_fixture
  
Add nicer ids for tests
## Code Before:
import os

import pytest

from tests.consts import examples_path
from valohai_yaml import parse


def _load_config(filename, roundtrip):
    with open(os.path.join(examples_path, filename), 'r') as infp:
        config = parse(infp)
    if roundtrip:
        config = parse(config.serialize())
    return config


def config_fixture(name):
    @pytest.fixture(params=[False, True])
    def _config_fixture(request):
        return _load_config(name, roundtrip=request.param)

    return _config_fixture

## Instruction:
Add nicer ids for tests
## Code After:
import os

import pytest

from tests.consts import examples_path
from valohai_yaml import parse


def _load_config(filename, roundtrip):
    with open(os.path.join(examples_path, filename), 'r') as infp:
        config = parse(infp)
    if roundtrip:
        config = parse(config.serialize())
    return config


def config_fixture(name):
    @pytest.fixture(params=[False, True], ids=['direct', 'roundtrip'])
    def _config_fixture(request):
        return _load_config(name, roundtrip=request.param)

    return _config_fixture
