diff --git a/Control/AthenaCommon/python/CFElements.py b/Control/AthenaCommon/python/CFElements.py index df7e9e47a92ce2926fcee1756df14b28a6dfcc72..c7996cbdc326d846ad6266a79d7a955e39b5a306 100755 --- a/Control/AthenaCommon/python/CFElements.py +++ b/Control/AthenaCommon/python/CFElements.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from __future__ import print_function from AthenaConfiguration.ComponentFactory import CompFactory from AthenaCommon.Configurable import Configurable @@ -313,16 +313,20 @@ class TestLegacyCF( unittest.TestCase, TestCF ): from AthenaCommon.Configurable import ConfigurablePyAlgorithm Configurable.configurableRun3Behavior=0 top = parOR("top") - top += parOR("nest1") - nest2 = seqAND("nest2") - top += nest2 - top += ConfigurablePyAlgorithm("SomeAlg0") - nest2 += parOR("deep_nest1") - nest2 += parOR("deep_nest2") - - nest2 += ConfigurablePyAlgorithm("SomeAlg1") - nest2 += ConfigurablePyAlgorithm("SomeAlg2") - nest2 += ConfigurablePyAlgorithm("SomeAlg3") + + # Skip initialization if it's already been done... otherwise, we'll + # get errors about duplicates. + if not top.getChildren(): + top += parOR("nest1") + nest2 = seqAND("nest2") + top += nest2 + top += ConfigurablePyAlgorithm("SomeAlg0") + nest2 += parOR("deep_nest1") + nest2 += parOR("deep_nest2") + + nest2 += ConfigurablePyAlgorithm("SomeAlg1") + nest2 += ConfigurablePyAlgorithm("SomeAlg2") + nest2 += ConfigurablePyAlgorithm("SomeAlg3") self.top = top diff --git a/Control/AthenaCommon/share/CFElementsTest.ref b/Control/AthenaCommon/share/CFElementsTest.ref new file mode 100644 index 0000000000000000000000000000000000000000..0f9878b530f3b73cafb86cd4bb665a30e749ef00 --- /dev/null +++ b/Control/AthenaCommon/share/CFElementsTest.ref @@ -0,0 +1,17 @@ +test_findAlgorithms (AthenaCommon.CFElements.TestConf2CF) ... ok +test_findDeep (AthenaCommon.CFElements.TestConf2CF) ... ok +test_findMissing (AthenaCommon.CFElements.TestConf2CF) ... ok +test_findRespectingScope (AthenaCommon.CFElements.TestConf2CF) ... ok +test_findTop (AthenaCommon.CFElements.TestConf2CF) ... ok +test_flatCollectors (AthenaCommon.CFElements.TestConf2CF) ... ok +test_findAlgorithms (AthenaCommon.CFElements.TestLegacyCF) ... ok +test_findDeep (AthenaCommon.CFElements.TestLegacyCF) ... ok +test_findMissing (AthenaCommon.CFElements.TestLegacyCF) ... ok +test_findRespectingScope (AthenaCommon.CFElements.TestLegacyCF) ... ok +test_findTop (AthenaCommon.CFElements.TestLegacyCF) ... ok +test_flatCollectors (AthenaCommon.CFElements.TestLegacyCF) ... ok + +---------------------------------------------------------------------- +Ran 12 tests in 0.002s + +OK