diff --git a/tests/test_preprocess.py b/tests/test_preprocess.py index d964744e..0f01f27e 100644 --- a/tests/test_preprocess.py +++ b/tests/test_preprocess.py @@ -3,6 +3,21 @@ Dexelas_Arguments, HexrdPPScript_Arguments, ) +import pytest +from pathlib import Path + + +# FIXME: this is not the appropriate file to test the preprocess scrips since +# it is missing metadata. Until we add a file we just test that +# validate_arguments() works as expected +@pytest.fixture +def eiger_examples_path(example_repo_path: Path) -> Path: + return Path(example_repo_path) / 'eiger' + + +@pytest.fixture +def ceria_examples_path(eiger_examples_path: Path) -> Path: + return eiger_examples_path / 'first_ceria' / 'ff_000_data_000001.h5' # test load/safe with defaults @@ -21,13 +36,17 @@ def test_save_load_defaults_dexelas(): # test load/safe with modified parameters -def test_save_load_eiger(): +def test_save_load_eiger(ceria_examples_path): eargs = Eiger_Arguments() - eargs.base_dir = "/data" - eargs.num_frames = 1 buffer = eargs.dump_config() args = HexrdPPScript_Arguments.load_from_config(buffer) assert eargs == args + with pytest.raises( + RuntimeError + ): # required argument 'absolute_path' is missing + args.validate_arguments() + args.absolute_path = str(ceria_examples_path) + args.validate_arguments() def test_save_load_dexelas(): @@ -38,3 +57,5 @@ def test_save_load_dexelas(): buffer = eargs.dump_config() args = HexrdPPScript_Arguments.load_from_config(buffer) assert eargs == args + with pytest.raises(RuntimeError): # many required arguments are missing + args.validate_arguments()