Skip to content

Commit ad335fb

Browse files
author
Carlos Hernandez
committed
add test
1 parent 95f6c6d commit ad335fb

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

devtools/conda-recipe/meta.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ test:
3333
- nose
3434
- nose-timer
3535
- gpy
36+
- skorch
3637
- msmbuilder
3738
- msmb_data
3839
- mdtraj

osprey/tests/test_cli_worker_and_dump.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
except:
1616
HAVE_MSMBUILDER = False
1717

18+
try:
19+
__import__('skorch')
20+
HAVE_SKORCH = True
21+
except:
22+
HAVE_SKORCH = False
23+
24+
1825
OSPREY_BIN = find_executable('osprey')
1926

2027

@@ -136,6 +143,30 @@ def test_gp_example():
136143
shutil.rmtree(dirname)
137144

138145

146+
@skipif(not HAVE_SKORCH, 'this test requires Skorch')
147+
def test_torch_example():
148+
assert OSPREY_BIN is not None
149+
cwd = os.path.abspath(os.curdir)
150+
dirname = tempfile.mkdtemp()
151+
152+
try:
153+
os.chdir(dirname)
154+
subprocess.check_call([OSPREY_BIN, 'skeleton', '-t', 'torch',
155+
'-f', 'config.yaml'])
156+
subprocess.check_call([OSPREY_BIN, 'worker', 'config.yaml', '-n', '1'])
157+
assert os.path.exists('osprey-trials.db')
158+
159+
subprocess.check_call([OSPREY_BIN, 'current_best', 'config.yaml'])
160+
161+
yield _test_dump_1
162+
163+
yield _test_plot_1
164+
165+
finally:
166+
os.chdir(cwd)
167+
shutil.rmtree(dirname)
168+
169+
139170
def test_grid_example():
140171
assert OSPREY_BIN is not None
141172
cwd = os.path.abspath(os.curdir)

0 commit comments

Comments
 (0)