Explorar o código

test script behaviour when not finding any volume files

https://github.com/fphammerle/freesurfer-volume-reader/issues/10
Fabian Peter Hammerle %!s(int64=5) %!d(string=hai) anos
pai
achega
879cd17783
Modificáronse 1 ficheiros con 10 adicións e 0 borrados
  1. 10 0
      tests/main_test.py

+ 10 - 0
tests/main_test.py

@@ -202,6 +202,16 @@ def test_main_root_dir_filename_regex_combined(capsys):
     )
 
 
+def test_main_no_files_found(capsys):
+    with unittest.mock.patch('sys.argv', ['', '--freesurfer-hipposf-filename-regex', r'^21$',
+                                          '--', SUBJECTS_DIR]):
+        with pytest.raises(ValueError):
+            freesurfer_volume_reader.__main__.main()
+    out, err = capsys.readouterr()
+    assert not out
+    assert not err
+
+
 def test_main_module_script_help():
     subprocess.run(['python', '-m', 'freesurfer_volume_reader', '--help'],
                    check=True)