diff Tests/Tests.py @ 306:da2be3ff2db5 c-get

fix getscu binaries
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 20 May 2020 08:41:21 +0200
parents b55b959647ed
children 5be63aef39b1
line wrap: on
line diff
--- a/Tests/Tests.py	Tue May 12 14:36:29 2020 +0200
+++ b/Tests/Tests.py	Wed May 20 08:41:21 2020 +0200
@@ -35,14 +35,16 @@
 
 _LOCAL = None
 _REMOTE = None
-
-
-def SetOrthancParameters(local, remote):
-    global _LOCAL, _REMOTE
+_DOCKER = False
+
+
+def SetOrthancParameters(local, remote, withinDocker):
+    global _LOCAL, _REMOTE, _DOCKER
     _LOCAL = local
     _REMOTE = remote
-
-
+    _DOCKER = withinDocker
+
+    
 def ExtractDicomTags(rawDicom, tags):
     with tempfile.NamedTemporaryFile(delete = True) as f:
         f.write(rawDicom)
@@ -5635,7 +5637,13 @@
         
 
     def test_getscu(self):
-        
+        env = {}
+        if _DOCKER:
+            # This is "getscu" from DCMTK 3.6.5 compiled using LSB,
+            # and running in a GNU/Linux distribution running DCMTK
+            # 3.6.0. Tell "getscu" where it can find the DICOM dictionary.
+            env['DCMDICTPATH'] = '/usr/share/libdcmtk2/dicom.dic'
+
         # no transcoding required
         UploadInstance(_REMOTE, 'DummyCT.dcm')
 
@@ -5643,15 +5651,16 @@
             shutil.rmtree('/tmp/GETSCU')
         os.makedirs('/tmp/GETSCU')
 
-        subprocess.check_call([ FindExecutable('getscu'),
-                                _REMOTE['Server'], 
-                                str(_REMOTE['DicomPort']),
-                                '-aec', 'ORTHANC',
-                                '-aet', 'ORTHANCTEST', # pretend to be the other orthanc
-                                '-k', '0020,000d=1.2.840.113619.2.176.2025.1499492.7391.1171285944.390',
-                                '-k', '0008,0052=STUDY',
-                                '--output-directory', '/tmp/GETSCU/' 
-                             ])
+        subprocess.check_call([
+            FindExecutable('getscu'),
+            _REMOTE['Server'], 
+            str(_REMOTE['DicomPort']),
+            '-aec', 'ORTHANC',
+            '-aet', 'ORTHANCTEST', # pretend to be the other orthanc
+            '-k', '0020,000d=1.2.840.113619.2.176.2025.1499492.7391.1171285944.390',
+            '-k', '0008,0052=STUDY',
+            '--output-directory', '/tmp/GETSCU/' 
+        ], env = env)
 
         self.assertTrue(os.path.isfile('/tmp/GETSCU/MR.1.2.840.113619.2.176.2025.1499492.7040.1171286242.109'))