Browse Source

test `python -m` module call to increase coverage

Fabian Peter Hammerle 5 years ago
parent
commit
1abafc1ed8
2 changed files with 7 additions and 0 deletions
  1. 1 0
      examples/barplot.py
  2. 6 0
      tests/main_test.py

+ 1 - 0
examples/barplot.py

@@ -12,6 +12,7 @@ def generate_freesurfer_mode_label(row):
                      row['analysis_id'].split('_')[0] if row['analysis_id'] else None]
     return ' & '.join(filter(None, mri_sequences))
 
+
 def main():
     argparser = argparse.ArgumentParser()
     argparser.add_argument('--subject', required=True)

+ 6 - 0
tests/main_test.py

@@ -1,5 +1,6 @@
 import io
 import os
+import subprocess
 import typing
 import unittest.mock
 
@@ -95,3 +96,8 @@ def test_main_root_dir_filename_regex(capsys):
         expected_frame=expected_volume_frame[expected_volume_frame['analysis_id'] == 'T2'].copy(),
         capsys=capsys,
     )
+
+
+def test_main_module_script():
+    subprocess.run(['python', '-m', 'freesurfer_volume_reader', '--help'],
+                   check=True)