annotate tests/common.py @ 73:16b3a11db8d2

add stub read functionality
author Jeff Hammel <k0scist@gmail.com>
date Sun, 17 Dec 2017 13:27:24 -0800
parents b911a7c01727
children 4f197c057e26
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
63
b911a7c01727 add test common functionality
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
1 """
b911a7c01727 add test common functionality
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
2 testing common
b911a7c01727 add test common functionality
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
3 """
b911a7c01727 add test common functionality
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
4
b911a7c01727 add test common functionality
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
5 import os
b911a7c01727 add test common functionality
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
6 from nettwerk import read
b911a7c01727 add test common functionality
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
7
b911a7c01727 add test common functionality
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
8 here = os.path.dirname(os.path.abspath(__file__))
b911a7c01727 add test common functionality
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
9 data = os.path.join(here, 'data')
b911a7c01727 add test common functionality
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
10
b911a7c01727 add test common functionality
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
11 def datafile(*path):
b911a7c01727 add test common functionality
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
12 """returns path within `tests/data`"""
b911a7c01727 add test common functionality
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
13
b911a7c01727 add test common functionality
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
14 return os.path.join(data, *path)
b911a7c01727 add test common functionality
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
15
b911a7c01727 add test common functionality
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
16 def load(*path, **kwargs):
b911a7c01727 add test common functionality
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
17 """load a data file"""
b911a7c01727 add test common functionality
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
18
b911a7c01727 add test common functionality
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
19 return read.read(datafile(*path), **kwargs)
b911a7c01727 add test common functionality
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
20