(path)
| 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 |