MCPcopy Create free account
hub / github.com/apache/arrow / load_fixture

Function load_fixture

dev/archery/conftest.py:52–70  ·  view source on GitHub ↗
(request)

Source from the content-addressed store, hash-verified

50
51@pytest.fixture
52def load_fixture(request):
53 current_test_directory = pathlib.Path(request.node.fspath).parent
54
55 def decoder(path):
56 with path.open('r') as fp:
57 if path.suffix == '.json':
58 import json
59 return json.load(fp)
60 elif path.suffix == '.yaml':
61 import yaml
62 return yaml.load(fp)
63 else:
64 return fp.read()
65
66 def loader(name, decoder=decoder):
67 path = current_test_directory / 'fixtures' / name
68 return decoder(path)
69
70 return loader

Calls 1

PathMethod · 0.45

Tested by

no test coverage detected