Skip to content

Commit

Permalink
Merge pull request #51 from dave3d/FunctionalTest
Browse files Browse the repository at this point in the history
Changed dicom2stl test to function call
  • Loading branch information
dave3d committed Jun 6, 2023
2 parents e11a96c + f60ef51 commit 034491c
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions tests/test_dicom2stl.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import unittest
import subprocess
import os

import SimpleITK as sitk
import parseargs
import dicom2stl

from tests import create_data

Expand All @@ -21,22 +22,22 @@ def tearDownClass(cls):
os.remove("testout.stl")

def test_dicom2stl(self):
print("Dicom2stl test")
print(os.getcwd())
runresult = subprocess.run(
[
"python",
"dicom2stl.py",
"-i",
"100",
"-o",
"testout.stl",
"tetra-test.nii.gz",
]
print("\nDicom2stl test")
print("cwd:", os.getcwd())

parser = parseargs.createParser()
args = parser.parse_args(
["-i", "100", "-o", "testout.stl", "tetra-test.nii.gz"]
)
print(runresult.returncode)
if runresult.returncode:
self.fail("dicom2stl process returned bad code")

print("\ndicom2stl arguments")
print(args)

try:
dicom2stl.dicom2stl(args)
except BaseException:
self.fail("dicom2stl: exception thrown")

if not os.path.exists("testout.stl"):
self.fail("dicom2stl: no output file")

Expand Down

0 comments on commit 034491c

Please sign in to comment.