Skip to content

Commit

Permalink
Adding std printing to test reporting to help with errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rbeck4 committed Mar 20, 2019
1 parent bf411d2 commit a08cd27
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ install:
- pip install --user keras_applications==1.0.6
- pip install --user keras_preprocessing==1.0.5
- pip install --user keras==2.2.4
- pip install --user coveralls

#only test on master and tests branches
branches:
Expand All @@ -49,7 +50,7 @@ before_script:
#Run Unittests
script:
- python numpyversion.py
- py.test --pyargs speedcom --cov-report term-missing --cov=speedcom --cov-config .coveragerc
- py.test -s --pyargs speedcom --cov-report term-missing --cov=speedcom --cov-config .coveragerc

#Print coverage reports
after_success:
Expand Down
2 changes: 1 addition & 1 deletion runtests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

py.test --pyargs speedcom --cov-report term-missing --cov=speedcom --cov-config .coveragerc
py.test -s --pyargs speedcom --cov-report term-missing --cov=speedcom --cov-config .coveragerc
rm speedcom/tests/__pycache__/*
10 changes: 9 additions & 1 deletion speedcom/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#import speedcom

def initiate_molecules(data_dir):
def initiate_molecules(data_dir, test=False):
"""
Takes in the directory containing all of the data files and returns a list
of populated molecule objects.
Expand All @@ -28,6 +28,10 @@ def initiate_molecules(data_dir):
my_molecules.append(Molecule(absorp, cid, columb, emiss, \
smiles, weight, file_name))
my_added_molecules.append(cid)
if test:
print("ems cid: ", cid)
else:
pass
else:
pass
#For all applicable absorption spectra put properties into molecule
Expand All @@ -39,6 +43,10 @@ def initiate_molecules(data_dir):
#it does, does it already have valid absorption peaks:
if pubchem_molecule:
cid = pubchem_molecule.cid
if test:
print("abs cid: ", cid)
else:
pass
if cid in my_added_molecules:
found = 1
mol_index = my_added_molecules.index(cid)
Expand Down
3 changes: 2 additions & 1 deletion speedcom/tests/test_speedcom.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ def test_proper_size(self):
Ensure the appropriate number of molecule objects are returned
upon initialization.
"""
mol_list_len = len(context.core.initiate_molecules(testing_dir))
mol_list_len = len(context.core.initiate_molecules(testing_dir, \
test=True))
assert mol_list_len == 5, "initiate_molecules unable to find all \
molecules, len = %f" %(mol_list_len)
return
Expand Down

0 comments on commit a08cd27

Please sign in to comment.