Skip to content

Commit

Permalink
fix test execution
Browse files Browse the repository at this point in the history
  • Loading branch information
marscher committed Feb 17, 2017
1 parent 697f022 commit 2f3066e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 30 deletions.
3 changes: 3 additions & 0 deletions conda-recipe/meta.yaml
Expand Up @@ -21,6 +21,9 @@ requirements:
- msmtools >=1.1.3

test:
source_files:
- test/*.py
- .coveragerc
requires:
- nose
- coverage ==4
Expand Down
31 changes: 1 addition & 30 deletions conda-recipe/run_test.py
Expand Up @@ -5,45 +5,16 @@
import shutil
import re

src_dir = os.getenv('SRC_DIR')

def coverage_report():
fn = '.coverage'
assert os.path.exists(fn)
build_dir = os.getenv('TRAVIS_BUILD_DIR')
dest = os.path.join(build_dir, fn)
print( "copying coverage report to", dest)
shutil.copy(fn, dest)
assert os.path.exists(dest)

# fix paths in .coverage file
with open(dest, 'r') as fh:
data = fh.read()
match= '"/home/travis/miniconda/envs/_test/lib/python.+?/site-packages/.+?/(thermotools/.+?)"'
repl = '"%s/\\1"' % build_dir
data = re.sub(match, repl, data)
os.unlink(dest)
with open(dest, 'w+') as fh:
fh.write(data)

nose_run = [
"nosetests",
os.path.join(src_dir, "test"),
"test",
"-vv",
"--with-coverage",
"--cover-inclusive",
"--cover-package=thermotools",
"--with-doctest",
"--doctest-options=+NORMALIZE_WHITESPACE,+ELLIPSIS"]

shutil.copyfile(
os.path.join(src_dir, ".coveragerc"),
os.path.join(os.getcwd(), ".coveragerc"))

res = subprocess.call(nose_run)

# move .coverage file to git clone on Travis CI
if os.getenv('TRAVIS', False):
coverage_report()

sys.exit(res)

0 comments on commit 2f3066e

Please sign in to comment.