22import shutil
33import json
44import pytest
5- import expyre
5+ from expyre import config
66
77from .calculators .test_aims import aims_prerequisites
88
@@ -13,26 +13,24 @@ def _get_coding_blocks(nb_file):
1313 nb = json .load (fo )
1414 return ['' .join (cell ['source' ]) for cell in nb ['cells' ] if cell ['cell_type' ] == 'code' ]
1515
16- github_slurm_config = pytest .mark .skipif (
17- condition = "github" not in expyre .config .systems ,
18- reason = "Missing configuration file for remote execution"
19- )
20-
2116
2217@pytest .mark .parametrize (
23- ('nb_file' , 'idx_execute' ),
18+ ('nb_file' , 'idx_execute' , 'needs_expyre' ),
2419 (
25- pytest .param ('examples.buildcell.ipynb' , 'all' , id = 'buildcell' ,
20+ pytest .param ('examples.buildcell.ipynb' , 'all' , False , id = 'buildcell' ,
2621 marks = pytest .mark .skipif (not shutil .which ("buildcell" ), reason = "buildcell not in PATH" )),
27- pytest .param ('examples.dimers.ipynb' , 'all' , id = 'dimer structures' ),
28- pytest .param ('examples.select_fps.ipynb' , 'all' , id = 'select fps' ),
29- pytest .param ('examples.fhiaims_calculator.ipynb' , 'all' , id = 'fhiaims_calculator' ,
22+ pytest .param ('examples.dimers.ipynb' , 'all' , False , id = 'dimer structures' ),
23+ pytest .param ('examples.select_fps.ipynb' , 'all' , False , id = 'select fps' ),
24+ pytest .param ('examples.fhiaims_calculator.ipynb' , 'all' , False , id = 'fhiaims_calculator' ,
3025 marks = aims_prerequisites ),
31- pytest .param ("examples.daisy_chain_mlip_fitting.ipynb" , "all" , id = "daisy_chain_mlip_fitting" ,
32- marks = github_slurm_config )
26+ pytest .param ("examples.daisy_chain_mlip_fitting.ipynb" , "all" , False , id = "daisy_chain_mlip_fitting" )
3327 )
3428)
35- def test_example (tmp_path , nb_file , idx_execute , monkeypatch ):
29+ def test_example (tmp_path , nb_file , idx_execute , monkeypatch , needs_expyre , expyre_systems ):
30+ if needs_expyre and "github" not in expyre_systems :
31+ print (f'Notebook { nb_file } requires ExPyRe, but system "github" is not in config.json or'
32+ f'"EXPYRE_PYTEST_SYSTEMS" environment variable.' )
33+ return
3634 print ("running test_example" , nb_file )
3735 basepath = os .path .join (f'{ os .path .dirname (__file__ )} /../docs/source' )
3836 coding_blocks = _get_coding_blocks (f'{ basepath } /{ nb_file } ' )
0 commit comments