|
2 | 2 | from click.testing import CliRunner |
3 | 3 |
|
4 | 4 | import json |
| 5 | +import shutil |
5 | 6 |
|
6 | 7 | from paths_cli.commands.compile import * |
7 | 8 |
|
@@ -46,11 +47,34 @@ def test_select_loader(ext): |
46 | 47 | expected = load_yaml |
47 | 48 |
|
48 | 49 | assert select_loader("filename." + ext) is expected |
49 | | - pass |
50 | 50 |
|
51 | 51 | def test_select_loader_error(): |
52 | 52 | with pytest.raises(RuntimeError, match="Unknown file extension"): |
53 | 53 | select_loader('foo.bar') |
54 | 54 |
|
55 | | -def test_compile(): |
56 | | - pass |
| 55 | +def test_compile(ad_openmm, test_data_dir): |
| 56 | + runner = CliRunner() |
| 57 | + setup = test_data_dir / "setup.yml" |
| 58 | + shutil.copy2(str(setup), ad_openmm) |
| 59 | + with runner.isolated_filesystem(temp_dir=ad_openmm): |
| 60 | + import os |
| 61 | + cwd = os.getcwd() |
| 62 | + files = [setup, ad_openmm / "ad.pdb", ad_openmm / "system.xml", |
| 63 | + ad_openmm / "integrator.xml"] |
| 64 | + for filename in files: |
| 65 | + shutil.copy2(str(filename), cwd) |
| 66 | + pytest.skip() # TODO: right now we're not building the parsers |
| 67 | + result = runner.invoke( |
| 68 | + compile_, |
| 69 | + ['setup.yml', '-o', str(ad_openmm / 'setup.db')] |
| 70 | + ) |
| 71 | + assert result.exit_code == 0 |
| 72 | + from openpathsampling.experimental.storage import ( |
| 73 | + Storage, monkey_patch_all) |
| 74 | + st = Storage('setup.db', mode='r') |
| 75 | + |
| 76 | + # smoke tests that we can reload things |
| 77 | + engine = st.engines['engine'] |
| 78 | + phi = st.cvs['phi'] |
| 79 | + C_7eq = st.volumes['C_7eq'] |
| 80 | + pytest.skip() |
0 commit comments