Skip to content

Commit

Permalink
Restructured the codebase to add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
julius-datajunkie committed Jan 8, 2014
1 parent bf1aef3 commit f99be01
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 54 deletions.
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
10 changes: 0 additions & 10 deletions PerformanceAnalytics/utils/returns_test.py

This file was deleted.

29 changes: 0 additions & 29 deletions PerformanceAnalytics/utils/utils.py

This file was deleted.

32 changes: 17 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
from setuptools import setup, find_packages
from setuptools.commnad.test import test as TestCommand
from setuptools.command.test import test as TestCommand
import io
import codecs
import os
import sys
import performanceanalytics


here = os.path.abspath(os.path.dirname(__file__))


def read(*filenames, **kwargs):
encoding = kwargs.get('encoding','utf-8')
sep = kwargs.get('sep','\n')
encoding = kwargs.get('encoding', 'utf-8')
sep = kwargs.get('sep', '\n')
buf = []
for filename in filenames:
with io.open(filename, encoding=encoding) as f:
buf.append(f.read())
return sep.join(buf)

long_description = read('README.txt','CHANGES.txt')
long_description = read('README.md', 'CHANGES.txt')


class PyTest(TestCommand):
def finalize_options(self):
Expand All @@ -32,20 +34,20 @@ def run_tests(self):

setup(
name='PerformanceAnalytics',
version= performanceanalytics.__version__,
version= 0.1,
url='http://github.com/zsljulius/performanceanalytics',
license='Apache Software license',
author='Shenglan Zhang',
tests_require=['pytest'],
install_requires=['numpy','Pandas'],
cmdclass={'test':PyTest}
author_email={'[email protected]'}
description='A python implementation of the PerformanceAnalytics in R'
long_description = long_description
packages = ["PerformanceAnalytics"]
install_requires=['numpy', 'Pandas'],
cmdclass={'test': PyTest},
author_email={'[email protected]'},
description='A python implementation of the PerformanceAnalytics in R',
long_description = long_description,
packages = ["PerformanceAnalytics"],
include_package_data=True,
platforms ='any'
test_suite='PerformanceAnalytics.test.test_PerformanceAnalytics'
platforms ='any',
test_suite='PerformanceAnalytics.test.test_PerformanceAnalytics',
classifiers=[
'Programming Language :: Python',
'Development Status :: 4 - Beta',
Expand All @@ -55,4 +57,4 @@ def run_tests(self):
extras_require ={
'testing':['pytest']
}

)
File renamed without changes.
13 changes: 13 additions & 0 deletions tests/test_returns.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from PerformanceAnalytics import returns
import pandas as pd


class TestReturns:
def test_rebalancing(self):
weights = pd.read_csv("weights.csv", parse_dates=[0])
edhec = pd.read_csv("edhec.csv", parse_dates=[0])
edhec.index = edhec.ix[:, 0]
weights.index = weights.ix[:, 0]
weights = weights.ix[:, 1:]
edhec = edhec.ix[:, 1:]
assert len(returns.rebalancing(edhec, weights)) == 116
File renamed without changes.

0 comments on commit f99be01

Please sign in to comment.