Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Hernandez committed Jun 27, 2018
1 parent 95f6c6d commit ad335fb
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions devtools/conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ test:
- nose
- nose-timer
- gpy
- skorch
- msmbuilder
- msmb_data
- mdtraj
Expand Down
31 changes: 31 additions & 0 deletions osprey/tests/test_cli_worker_and_dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
except:
HAVE_MSMBUILDER = False

try:
__import__('skorch')
HAVE_SKORCH = True
except:
HAVE_SKORCH = False


OSPREY_BIN = find_executable('osprey')


Expand Down Expand Up @@ -136,6 +143,30 @@ def test_gp_example():
shutil.rmtree(dirname)


@skipif(not HAVE_SKORCH, 'this test requires Skorch')
def test_torch_example():
assert OSPREY_BIN is not None
cwd = os.path.abspath(os.curdir)
dirname = tempfile.mkdtemp()

try:
os.chdir(dirname)
subprocess.check_call([OSPREY_BIN, 'skeleton', '-t', 'torch',
'-f', 'config.yaml'])
subprocess.check_call([OSPREY_BIN, 'worker', 'config.yaml', '-n', '1'])
assert os.path.exists('osprey-trials.db')

subprocess.check_call([OSPREY_BIN, 'current_best', 'config.yaml'])

yield _test_dump_1

yield _test_plot_1

finally:
os.chdir(cwd)
shutil.rmtree(dirname)


def test_grid_example():
assert OSPREY_BIN is not None
cwd = os.path.abspath(os.curdir)
Expand Down

0 comments on commit ad335fb

Please sign in to comment.