# HG changeset patch # User Sebastien Jodogne # Date 1786546280 -7200 # Node ID 1c40e067143e17321db5558ebca1856afc38c558 # Parent 20cf187b4727b4fe136927882733b8e46d4155a7 do not execute test_deeply_nested_sequence if the dcmtk patch is not applied diff -r 20cf187b4727 -r 1c40e067143e Tests/Tests.py --- a/Tests/Tests.py Wed Aug 12 15:29:25 2026 +0200 +++ b/Tests/Tests.py Wed Aug 12 16:51:20 2026 +0200 @@ -12797,10 +12797,12 @@ self.assertEqual(42, v[2]) def test_deeply_nested_sequence(self): - if IsOrthancVersionAbove(_REMOTE, 1, 13, 0): + if (IsThirdPartyLibraryVersionAbove(_REMOTE, 'dcmtk', 3, 7, 1) or + IsPatchApplied(_REMOTE, 'dcmtk-3.7.0-max-nested-sequence.patch')): + # note: unable to test with storescu since it does not support deeply nested sequences and crashes self.assertRaises(Exception, lambda: UploadInstance(_REMOTE, '2026-05-06-Deeply-Nested-Sequence.dcm')) - - # note: unable to test with storescu since it does not support deeply nested sequences and crashes + else: + self.skipTest('Skipping because the required resource is unavailable') # small functional test, mainly to detect memory leaks (https://github.com/orthanc-server/orthanc-builder/issues/36) diff -r 20cf187b4727 -r 1c40e067143e Tests/Toolbox.py --- a/Tests/Toolbox.py Wed Aug 12 15:29:25 2026 +0200 +++ b/Tests/Toolbox.py Wed Aug 12 16:51:20 2026 +0200 @@ -347,20 +347,6 @@ return name -def IsOrthancVersionAbove(orthanc, major, minor, revision): - v = DoGet(orthanc, '/system')['Version'] - - if v.startswith('mainline'): - return True - else: - tmp = v.split('.') - a = int(tmp[0]) - b = int(tmp[1]) - c = int(tmp[2]) - return (a > major or - (a == major and b > minor) or - (a == major and b == minor and c >= revision)) - def HasExtendedFind(orthanc): v = DoGet(orthanc, '/system') @@ -588,3 +574,47 @@ raise Exception() return result + + +def IsVersionAbove(version, major, minor, revision = None): + tmp = version.split('.') + + if revision == None: + assert(len(tmp) == 2) + a = int(tmp[0]) + b = int(tmp[1]) + return (a > major or + (a == major and b > minor)) + else: + assert(len(tmp) == 3) + a = int(tmp[0]) + b = int(tmp[1]) + c = int(tmp[2]) + return (a > major or + (a == major and b > minor) or + (a == major and b == minor and c >= revision)) + + +def IsOrthancVersionAbove(orthanc, major, minor, revision): + v = DoGet(orthanc, '/system')['Version'] + + if v.startswith('mainline'): + return True + else: + return IsVersionAbove(v, major, minor, revision) + + +def IsThirdPartyLibraryVersionAbove(orthanc, library, major, minor, revision): + try: + v = DoGet(orthanc, '/system') ['ThirdPartyVersions'][library] + return IsVersionAbove(v, major, minor, revision) + except: + return False + + +def IsPatchApplied(orthanc, patch): + try: + patches = DoGet(orthanc, '/system') ['ThirdPartyPatches'] + return patch in patches + except: + return False