Skip to content

Commit

Permalink
setup tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jpn-- committed Mar 13, 2017
1 parent 50e9daf commit 125ea31
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
11 changes: 7 additions & 4 deletions py/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,12 @@ def assertNearlyEqual(self, x, y, sigfigs=3):

_multiprocess_shared_ = True

def simple():
def simple(fail_fast=False):
import nose
return nose.run(argv=['-','--where='+os.path.split(__file__)[0],'--verbosity=3'])
argv=['-','--where='+os.path.split(__file__)[0],'--verbosity=3']
if fail_fast:
argv += ['--stop',]
return nose.run(argv=argv)

def these(*args):
import nose
Expand All @@ -97,7 +100,7 @@ def these(*args):

# nosetests /Users/jpn/anaconda/local/larch/test/test_mnl.py:TestMNL.test_qmnl_with_theta --verbosity=3

def run(exit=False):
def run(exit=False, fail_fast=False):
print("<"*30,"larch.test",">"*30)
print("FROM:",os.path.split(__file__)[0])
try:
Expand All @@ -108,7 +111,7 @@ def run(exit=False):
print("BUILD:", build)
print("CONFIG:", build_config)
print(">"*30,"larch.test","<"*30)
result = simple()
result = simple(fail_fast=fail_fast)
if exit:
import sys
sys.exit(0 if result else -1)
Expand Down
11 changes: 6 additions & 5 deletions setup_sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@

VERSION = '3.1.47'

usedir = os.path.dirname(__file__)
if sys.path[0] != usedir:
sys.path.insert(0, usedir)
#usedir = os.path.dirname(__file__)
#if sys.path[0] != usedir:
# sys.path.insert(0, usedir)

def file_at(*arg):
return os.path.join(usedir, *arg)
#return os.path.join(usedir, *arg)
return os.path.join(*arg)


import numpy
Expand Down Expand Up @@ -344,7 +345,7 @@ def build_sqlite(basepath=None):
need_to_update = False
for eachsource in source:
try:
print("checking filemod time on",os.path.join(shlib_folder(basepath), dylib_name_style.format(name)))
print("checking filemod time on",eachsource,' vs ',os.path.join(shlib_folder(basepath), dylib_name_style.format(name)))
need_to_update = need_to_update or (os.path.getmtime(eachsource) > os.path.getmtime(os.path.join(shlib_folder(basepath), dylib_name_style.format(name))))
except FileNotFoundError:
need_to_update = True
Expand Down
9 changes: 9 additions & 0 deletions setup_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import sys, os

from setup_common import lib_folder
os.chdir(lib_folder())
print(lib_folder())
sys.path.insert(0,lib_folder())

import larch.test
larch.test.run(exit=True, fail_fast=True)

0 comments on commit 125ea31

Please sign in to comment.