Skip to content

Commit

Permalink
Merge 3b5be62 into a597cd4
Browse files Browse the repository at this point in the history
  • Loading branch information
thijstriemstra committed Oct 13, 2020
2 parents a597cd4 + 3b5be62 commit 5637c5c
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions tests/baseline_data.py
@@ -1,11 +1,10 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2013-17 Richard Hull and contributors
# Copyright (c) 2013-2020 Richard Hull and contributors
# See LICENSE.rst for details.

import io
import json
import os.path
from pathlib import Path


__all__ = ['primitives', 'get_reference_data']
Expand All @@ -32,7 +31,13 @@ def primitives(device, draw):


def get_reference_data(fname):
dirname = os.path.abspath(os.path.dirname(__file__))
fpath = os.path.join(dirname, 'reference', 'data', fname + '.json')
with io.open(fpath) as f:
"""
Load JSON reference data.
:param fname: Filename without extension.
:type fname: str
"""
base_dir = Path(__file__).resolve().parent
fpath = base_dir.joinpath('reference', 'data', fname + '.json')
with fpath.open() as f:
return json.load(f)

0 comments on commit 5637c5c

Please sign in to comment.