Skip to content

Commit 804df8b

Browse files
author
Alvin Wan
committed
moved tests out of datatools, setup.py installs dependencies and tests
1 parent 44e48f9 commit 804df8b

File tree

3 files changed

+53
-2
lines changed

3 files changed

+53
-2
lines changed

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,20 @@
22

33
data tools for UC Berkeley's Data Science 10 course
44

5-
*written by Professor [John DeNero](http://denero.org), Professor [David Culler](http://www.cs.berkeley.edu/~culler), and [Alvin Wan](http://alvinwan.com)*
5+
*written by Professor [John DeNero](http://denero.org), Professor [David Culler](http://www.cs.berkeley.edu/~culler), and [Alvin Wan](http://alvinwan.com)*
6+
7+
## Installation
8+
9+
Use pip. The latest version is v0.1
10+
11+
```
12+
pip install git+git://github.com/alvinwan/datatools.git@v01
13+
```
14+
15+
If you clone this repository, you may run tests against datatools.
16+
17+
```
18+
python setup.py test
19+
```
20+
21+
If you encounter an `Image not found` error on **Mac OSX**, you may need an [XQuartz upgrade](http://xquartz.macosforge.org/landing/).

setup.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,43 @@
1+
import sys
12
from distutils.core import setup
3+
from setuptools.command.test import test as TestCommand
4+
5+
install_requires = [
6+
'numpy',
7+
'matplotlib',
8+
'pandas'
9+
]
10+
11+
test_requires = [
12+
'pytest'
13+
]
14+
15+
class PyTest(TestCommand):
16+
user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]
17+
18+
def initialize_options(self):
19+
TestCommand.initialize_options(self)
20+
self.pytest_args = []
21+
22+
def finalize_options(self):
23+
TestCommand.finalize_options(self)
24+
self.test_args = []
25+
self.test_suite = True
26+
27+
def run_tests(self):
28+
#import here, cause outside the eggs aren't loaded
29+
import pytest
30+
errno = pytest.main(self.pytest_args)
31+
sys.exit(errno)
32+
33+
234
setup(
335
name = 'datatools',
436
packages = ['datatools'],
537
version = '0.1',
38+
install_requires = install_requires,
39+
tests_require = test_requires,
40+
cmdclass = {'test': PyTest},
641
description = 'datatools for UC Berkeley\'s DS10 course',
742
author = 'John DeNero, David Culler, Alvin Wan',
843
author_email = '',

tests/test_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from lib.data import *
1+
from datatools.data import *
22
import re
33
import pytest
44
from numpy.testing import assert_array_equal

0 commit comments

Comments
 (0)