Skip to content

Commit 732ca0f

Browse files
committed
testing
1 parent 7adc94d commit 732ca0f

File tree

7 files changed

+120
-7
lines changed

7 files changed

+120
-7
lines changed

.travis.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
language: python
2+
python:
3+
- "3.4"
4+
install:
5+
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
6+
- bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/miniconda
7+
- export PATH="$HOME/miniconda/bin:$PATH"
8+
9+
- conda config --add channels conda-forge
10+
- conda config --add channels bioconda
11+
- conda config --set always_yes yes --set changeps1 no
12+
- conda config --set show_channel_urls True
13+
14+
- ENV_NAME='testing'
15+
- conda create --quiet -n $ENV_NAME python=$TRAVIS_PYTHON_VERSION
16+
- source activate $ENV_NAME
17+
- conda install --quiet --file conda-requirements.txt
18+
- conda list
19+
- conda info -a
20+
- python setup.py --quiet install
21+
22+
script:
23+
python -m unittest discover -s bald.tests -v

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
# bald
1+
# Binary Array Linked Data: bald
2+
23
[![Build Status](https://api.travis-ci.org/repositories/binary-array-ld/bald.svg?branch=master)](http://travis-ci.org/binary-array-ld/bald/branches)
3-
Python library for validating and managing binary array linked data files.
4+
5+
A Python library for validating and managing binary array linked data files.

conda-requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
numpy
2+
h5py
3+
netCDF4
4+
requests
5+
rdflib

lib/bald/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import bald.validation as bv
99

10+
__version__ = '0.2'
1011

1112
class HttpCache(object):
1213
"""

lib/bald/tests/unit/test_validation.py renamed to lib/bald/tests/unit/test_HttpCache.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@
44
import numpy as np
55

66
from bald.tests import BaldTestCase
7-
from bald import validation
7+
import bald
8+
9+
class TestHttpCache(unittest.TestCase):
10+
def setUp(self):
11+
self.cache = bald.HttpCache()
812

9-
class Test(unittest.TestCase):
1013
def test_check_uri_200(self):
1114
auri = 'http://binary-array-ld.net/experimental'
12-
self.assertTrue(validation.check_uri(auri))
15+
self.assertTrue(self.cache.check_uri(auri))
1316

1417
def test_check_uri_404(self):
1518
notauri = 'http://binary-array-ld.net/experimentalish'
16-
self.assertFalse(validation.check_uri(notauri))
19+
self.assertFalse(self.cache.check_uri(notauri))
1720

1821

1922
if __name__ == '__main__':

lib/bald/validation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def check_attr_domain_range(self, exceptions):
113113
data=self.cache[uri].text
114114
try:
115115
g.parse(data=self.cache[uri].text, format="n3")
116-
except Exception, e:
116+
except Exception:
117117
g.parse(data=self.cache[uri].text, format="xml")
118118
query = ('SELECT ?s \n'
119119
'(GROUP_CONCAT(?domain; SEPARATOR=" | ") AS ?domains)'

setup.py

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/usr/bin/env python
2+
from __future__ import print_function
3+
4+
import os
5+
from setuptools import setup
6+
7+
8+
DESCRIPTION = 'Binary Array Linked Data'
9+
NAME = 'bald'
10+
DIR_ROOT = os.path.abspath(os.path.dirname(__file__))
11+
DIR_PACKAGE = os.path.join(DIR_ROOT, 'lib', NAME)
12+
#DIR_DATA = os.path.join(DIR_PACKAGE, 'sample_data')
13+
14+
15+
def extract_version():
16+
version = None
17+
fname = os.path.join(DIR_PACKAGE, '__init__.py')
18+
with open(fname) as fin:
19+
for line in fin:
20+
if (line.startswith('__version__')):
21+
_, version = line.split('=')
22+
version = version.strip()[1:-1] # Remove quotation.
23+
break
24+
return version
25+
26+
27+
def extract_description():
28+
description = DESCRIPTION
29+
fname = os.path.join(DIR_ROOT, 'README.rst')
30+
if os.path.isfile(fname):
31+
with open(fname) as fin:
32+
description = fin.read()
33+
return description
34+
35+
36+
# def extract_package_data():
37+
# package_data = []
38+
# offset = len(os.path.dirname(DIR_DATA)) + 1
39+
# for dpath, dnames, fnames in os.walk(DIR_DATA):
40+
# globs = set()
41+
# fpath = os.path.join(dpath[offset:])
42+
# for fname in fnames:
43+
# _, ext = os.path.splitext(fname)
44+
# globs.add('*{}'.format(ext))
45+
# for glob in globs:
46+
# package_data.append(os.path.join(fpath, glob))
47+
# return {NAME: package_data}
48+
49+
50+
setup_args = dict(
51+
name=NAME,
52+
version=extract_version(),
53+
description=DESCRIPTION,
54+
long_description=extract_description(),
55+
platforms=['Linux', 'Max OS X', 'Windows'],
56+
license='BSD',
57+
url='https://github.com/binary-array-ld/bald',
58+
package_dir={'': 'lib'},
59+
packages=[NAME],
60+
# package_data=extract_package_data(),
61+
classifiers=[
62+
# For full license details, see
63+
# http://reference.data.gov.uk/id/open-government-licence
64+
'License :: Freely Distributable',
65+
'Development Status :: 1 - Planning Development Status',
66+
'Programming Language :: Python :: 2.7',
67+
'Programming Language :: Python :: 3.4',
68+
'Programming Language :: Python :: 3.5',
69+
'Operating System :: OS Independent',
70+
'Intended Audience :: Science/Research',
71+
'Intended Audience :: Developers',
72+
'Natural Language :: English',
73+
'Topic :: Scientific/Engineering',
74+
'Topic :: Software Development :: Libraries'],
75+
)
76+
77+
78+
if __name__ == '__main__':
79+
setup(**setup_args)

0 commit comments

Comments
 (0)