Skip to content

Commit

Permalink
nosetests, travis, hotfix setup.py ValueError for read function
Browse files Browse the repository at this point in the history
  • Loading branch information
mbeissinger committed May 12, 2015
1 parent 3cb13e9 commit d91a595
Show file tree
Hide file tree
Showing 19 changed files with 42 additions and 20 deletions.
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
language: python
python:
- "2.6"
- "2.7"
- "3.2"
- "3.3"
- "3.4"
- "nightly"
# command to install dependencies
install:
- "pip install -r requirements.txt"
# command to run tests
script: nosetests
8 changes: 5 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,18 @@ def __getattr__(cls, name):
# a list of builtin themes.
# html_theme = 'default'
# html_theme = 'sphinxdoc'
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
if not on_rtd:
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}

# Add any paths that contain custom themes here, relative to this directory.
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
if not on_rtd:
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
Expand Down
7 changes: 0 additions & 7 deletions opendeep/data/tests/test_midi.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
# standard libraries
from __future__ import print_function
import unittest
import logging
import numpy
import time
# internal references
from opendeep.data.standard_datasets.midi.musedata import MuseData
from opendeep.data.standard_datasets.midi.jsb_chorales import JSBChorales
from opendeep.data.standard_datasets.midi.nottingham import Nottingham
from opendeep.data.standard_datasets.midi.piano_midi_de import PianoMidiDe
from opendeep.data.dataset import TRAIN, VALID, TEST
import opendeep.log.logger as logger


class TestMuse(unittest.TestCase):

def setUp(self):
print("setting up!")
# configure the root logger
logger.config_root_logger()
# get a logger for this session
self.log = logging.getLogger(__name__)
# get the muse dataset
self.muse = MuseData()
# get the jsb dataset
Expand Down
8 changes: 8 additions & 0 deletions opendeep/log/tests/test_logger.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@
import logging
# internal references
import opendeep.log.logger as logger
from opendeep.utils.file_ops import mkdir_p

class TestLogger(unittest.TestCase):
def setUp(self):
self.current_dir = os.getcwd()
# go into this file's directory
abspath = os.path.realpath(__file__)
dname = os.path.dirname(abspath)
os.chdir(dname)
# change sys.stdout to StringIO for the duration of the test to test console output
self.saved_stdout = sys.stdout
self.out = StringIO()
Expand Down Expand Up @@ -51,6 +57,8 @@ def testErrorFile(self):

def tearDown(self):
sys.stdout = self.saved_stdout
# go back to old working directory
os.chdir(self.current_dir)


if __name__ == '__main__':
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions opendeep/monitor/tests/test_fileservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def main():

t1=time.time()

for epoch in range(100):
for epoch in range(10):
t=time.time()
log.debug(epoch)
vals = f()
Expand All @@ -61,7 +61,7 @@ def main():
service.write(m[name], TRAIN)
log.debug('----- '+make_time_units_string(time.time()-t))

for epoch in range(100):
for epoch in range(10):
t = time.time()
log.debug(epoch)
vals = f2()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
compute_CSL_with_minibatches, compute_CSL_with_minibatches_one_chain


def test_bernoulli_csl(switch=0):
def bernoulli_csl(switch=0):

mnist = MNIST()
train_x, _ = mnist.getSubset(TRAIN)
Expand Down Expand Up @@ -41,4 +41,4 @@ def test_bernoulli_csl(switch=0):

if __name__ == '__main__':
config_root_logger()
test_bernoulli_csl(switch=0)
bernoulli_csl(switch=0)
9 changes: 5 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Main requirements
numpy>=1.9.2
numpy>=1.8.1
scipy>=0.13.3
# Pillow is the successor to PIL for image processing
Pillow>=2.8.1
# The latest bleeding-edge Theano
--allow-external theano
--allow-unverified theano
git+https://github.com/Theano/Theano.git#egg=theano
#--allow-external theano
#--allow-unverified theano
#git+https://github.com/Theano/Theano.git#egg=theano
theano >= 0.7.0

# Optional requirements
# PyYAML for YAML parsing capability
Expand Down
9 changes: 7 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ def read(*filenames, **kwargs):
sep = kwargs.get('sep', '\n')
buf = []
for filename in filenames:
with io.open(filename, mode=mode, encoding=encoding) as f:
buf.append(f.read())
# hotfix for ValueError: binary mode doesn't take an encoding argument.
if 'b' not in mode:
with io.open(filename, mode=mode, encoding=encoding) as f:
buf.append(f.read())
else:
with io.open(filename, mode=mode) as f:
buf.append(f.read())
return sep.join(buf)

# Inform user of setup.py develop preference
Expand Down

0 comments on commit d91a595

Please sign in to comment.